mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
@@ -1107,7 +1107,13 @@ ElectronBrowserClient::GetSystemNetworkContext() {
|
||||
std::unique_ptr<content::BrowserMainParts>
|
||||
ElectronBrowserClient::CreateBrowserMainParts(
|
||||
const content::MainFunctionParams& params) {
|
||||
return std::make_unique<ElectronBrowserMainParts>(params);
|
||||
auto browser_main_parts = std::make_unique<ElectronBrowserMainParts>(params);
|
||||
|
||||
#if defined(OS_MAC)
|
||||
browser_main_parts_ = browser_main_parts.get();
|
||||
#endif
|
||||
|
||||
return browser_main_parts;
|
||||
}
|
||||
|
||||
void ElectronBrowserClient::WebNotificationAllowed(
|
||||
@@ -1817,4 +1823,13 @@ content::BluetoothDelegate* ElectronBrowserClient::GetBluetoothDelegate() {
|
||||
return bluetooth_delegate_.get();
|
||||
}
|
||||
|
||||
device::GeolocationSystemPermissionManager*
|
||||
ElectronBrowserClient::GetLocationPermissionManager() {
|
||||
#if defined(OS_MAC)
|
||||
return browser_main_parts_->GetLocationPermissionManager();
|
||||
#else
|
||||
return nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
||||
@@ -33,6 +33,7 @@ class SSLCertRequestInfo;
|
||||
|
||||
namespace electron {
|
||||
|
||||
class ElectronBrowserMainParts;
|
||||
class NotificationPresenter;
|
||||
class PlatformNotificationService;
|
||||
|
||||
@@ -89,6 +90,9 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
||||
|
||||
content::BluetoothDelegate* GetBluetoothDelegate() override;
|
||||
|
||||
device::GeolocationSystemPermissionManager* GetLocationPermissionManager()
|
||||
override;
|
||||
|
||||
protected:
|
||||
void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
|
||||
content::SpeechRecognitionManagerDelegate*
|
||||
@@ -342,6 +346,10 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
||||
std::unique_ptr<ElectronSerialDelegate> serial_delegate_;
|
||||
std::unique_ptr<ElectronBluetoothDelegate> bluetooth_delegate_;
|
||||
|
||||
#if defined(OS_MAC)
|
||||
ElectronBrowserMainParts* browser_main_parts_ = nullptr;
|
||||
#endif
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronBrowserClient);
|
||||
};
|
||||
|
||||
|
||||
@@ -95,6 +95,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(OS_MAC)
|
||||
#include "services/device/public/cpp/geolocation/geolocation_system_permission_mac.h"
|
||||
#include "shell/browser/ui/cocoa/views_delegate_mac.h"
|
||||
#else
|
||||
#include "shell/browser/ui/views/electron_views_delegate.h"
|
||||
@@ -569,6 +570,13 @@ ElectronBrowserMainParts::GetGeolocationControl() {
|
||||
return geolocation_control_.get();
|
||||
}
|
||||
|
||||
#if defined(OS_MAC)
|
||||
device::GeolocationSystemPermissionManager*
|
||||
ElectronBrowserMainParts::GetLocationPermissionManager() {
|
||||
return location_permission_manager_.get();
|
||||
}
|
||||
#endif
|
||||
|
||||
IconManager* ElectronBrowserMainParts::GetIconManager() {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
if (!icon_manager_.get())
|
||||
|
||||
@@ -36,6 +36,10 @@ class GtkUiDelegate;
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace device {
|
||||
class GeolocationSystemPermissionManager;
|
||||
} // namespace device
|
||||
|
||||
namespace electron {
|
||||
|
||||
class ElectronBrowserContext;
|
||||
@@ -80,6 +84,10 @@ class ElectronBrowserMainParts : public content::BrowserMainParts {
|
||||
// used to enable the location services once per client.
|
||||
device::mojom::GeolocationControl* GetGeolocationControl();
|
||||
|
||||
#if defined(OS_MAC)
|
||||
device::GeolocationSystemPermissionManager* GetLocationPermissionManager();
|
||||
#endif
|
||||
|
||||
// Returns handle to the class responsible for extracting file icons.
|
||||
IconManager* GetIconManager();
|
||||
|
||||
@@ -161,6 +169,11 @@ class ElectronBrowserMainParts : public content::BrowserMainParts {
|
||||
|
||||
mojo::Remote<device::mojom::GeolocationControl> geolocation_control_;
|
||||
|
||||
#if defined(OS_MAC)
|
||||
std::unique_ptr<device::GeolocationSystemPermissionManager>
|
||||
location_permission_manager_;
|
||||
#endif
|
||||
|
||||
static ElectronBrowserMainParts* self_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronBrowserMainParts);
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "base/mac/bundle_locations.h"
|
||||
#include "base/mac/foundation_util.h"
|
||||
#include "base/path_service.h"
|
||||
#include "services/device/public/cpp/geolocation/geolocation_system_permission_mac.h"
|
||||
#import "shell/browser/mac/electron_application.h"
|
||||
#include "shell/browser/mac/electron_application_delegate.h"
|
||||
#include "shell/common/electron_paths.h"
|
||||
@@ -27,6 +28,9 @@ void ElectronBrowserMainParts::PreMainMessageLoopStart() {
|
||||
[[NSUserDefaults standardUserDefaults]
|
||||
setObject:@"NO"
|
||||
forKey:@"NSTreatUnknownArgumentsAsOpen"];
|
||||
|
||||
location_permission_manager_ =
|
||||
device::GeolocationSystemPermissionManager::Create();
|
||||
}
|
||||
|
||||
void ElectronBrowserMainParts::FreeAppDelegate() {
|
||||
|
||||
Reference in New Issue
Block a user