parent
9142563748
commit
1b4ce6c69a
5 changed files with 44 additions and 1 deletions
|
@ -882,7 +882,13 @@ ElectronBrowserClient::GetSystemNetworkContext() {
|
||||||
std::unique_ptr<content::BrowserMainParts>
|
std::unique_ptr<content::BrowserMainParts>
|
||||||
ElectronBrowserClient::CreateBrowserMainParts(
|
ElectronBrowserClient::CreateBrowserMainParts(
|
||||||
const content::MainFunctionParams& params) {
|
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(
|
void ElectronBrowserClient::WebNotificationAllowed(
|
||||||
|
@ -1618,4 +1624,12 @@ void ElectronBrowserClient::RegisterBrowserInterfaceBindersForServiceWorker(
|
||||||
base::BindRepeating(&BindBadgeServiceForServiceWorker));
|
base::BindRepeating(&BindBadgeServiceForServiceWorker));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
device::GeolocationManager* ElectronBrowserClient::GetGeolocationManager() {
|
||||||
|
#if defined(OS_MAC)
|
||||||
|
return browser_main_parts_->GetGeolocationManager();
|
||||||
|
#else
|
||||||
|
return nullptr;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace electron
|
} // namespace electron
|
||||||
|
|
|
@ -34,6 +34,7 @@ class SSLCertRequestInfo;
|
||||||
|
|
||||||
namespace electron {
|
namespace electron {
|
||||||
|
|
||||||
|
class ElectronBrowserMainParts;
|
||||||
class NotificationPresenter;
|
class NotificationPresenter;
|
||||||
class PlatformNotificationService;
|
class PlatformNotificationService;
|
||||||
|
|
||||||
|
@ -88,6 +89,8 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
||||||
|
|
||||||
content::BluetoothDelegate* GetBluetoothDelegate() override;
|
content::BluetoothDelegate* GetBluetoothDelegate() override;
|
||||||
|
|
||||||
|
device::GeolocationManager* GetGeolocationManager() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
|
void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
|
||||||
content::SpeechRecognitionManagerDelegate*
|
content::SpeechRecognitionManagerDelegate*
|
||||||
|
@ -299,6 +302,10 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
||||||
std::unique_ptr<ElectronSerialDelegate> serial_delegate_;
|
std::unique_ptr<ElectronSerialDelegate> serial_delegate_;
|
||||||
std::unique_ptr<ElectronBluetoothDelegate> bluetooth_delegate_;
|
std::unique_ptr<ElectronBluetoothDelegate> bluetooth_delegate_;
|
||||||
|
|
||||||
|
#if defined(OS_MAC)
|
||||||
|
ElectronBrowserMainParts* browser_main_parts_ = nullptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(ElectronBrowserClient);
|
DISALLOW_COPY_AND_ASSIGN(ElectronBrowserClient);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -93,6 +93,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(OS_MAC)
|
#if defined(OS_MAC)
|
||||||
|
#include "services/device/public/cpp/geolocation/geolocation_manager.h"
|
||||||
#include "shell/browser/ui/cocoa/views_delegate_mac.h"
|
#include "shell/browser/ui/cocoa/views_delegate_mac.h"
|
||||||
#else
|
#else
|
||||||
#include "shell/browser/ui/views/electron_views_delegate.h"
|
#include "shell/browser/ui/views/electron_views_delegate.h"
|
||||||
|
@ -553,6 +554,12 @@ ElectronBrowserMainParts::GetGeolocationControl() {
|
||||||
return geolocation_control_.get();
|
return geolocation_control_.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(OS_MAC)
|
||||||
|
device::GeolocationManager* ElectronBrowserMainParts::GetGeolocationManager() {
|
||||||
|
return geolocation_manager_.get();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
IconManager* ElectronBrowserMainParts::GetIconManager() {
|
IconManager* ElectronBrowserMainParts::GetIconManager() {
|
||||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||||
if (!icon_manager_.get())
|
if (!icon_manager_.get())
|
||||||
|
|
|
@ -39,6 +39,10 @@ class GtkUiPlatform;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace device {
|
||||||
|
class GeolocationManager;
|
||||||
|
} // namespace device
|
||||||
|
|
||||||
namespace electron {
|
namespace electron {
|
||||||
|
|
||||||
class ElectronBrowserContext;
|
class ElectronBrowserContext;
|
||||||
|
@ -83,6 +87,10 @@ class ElectronBrowserMainParts : public content::BrowserMainParts {
|
||||||
// used to enable the location services once per client.
|
// used to enable the location services once per client.
|
||||||
device::mojom::GeolocationControl* GetGeolocationControl();
|
device::mojom::GeolocationControl* GetGeolocationControl();
|
||||||
|
|
||||||
|
#if defined(OS_MAC)
|
||||||
|
device::GeolocationManager* GetGeolocationManager();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Returns handle to the class responsible for extracting file icons.
|
// Returns handle to the class responsible for extracting file icons.
|
||||||
IconManager* GetIconManager();
|
IconManager* GetIconManager();
|
||||||
|
|
||||||
|
@ -161,6 +169,10 @@ class ElectronBrowserMainParts : public content::BrowserMainParts {
|
||||||
|
|
||||||
mojo::Remote<device::mojom::GeolocationControl> geolocation_control_;
|
mojo::Remote<device::mojom::GeolocationControl> geolocation_control_;
|
||||||
|
|
||||||
|
#if defined(OS_MAC)
|
||||||
|
std::unique_ptr<device::GeolocationManager> geolocation_manager_;
|
||||||
|
#endif
|
||||||
|
|
||||||
static ElectronBrowserMainParts* self_;
|
static ElectronBrowserMainParts* self_;
|
||||||
|
|
||||||
DISALLOW_COPY_AND_ASSIGN(ElectronBrowserMainParts);
|
DISALLOW_COPY_AND_ASSIGN(ElectronBrowserMainParts);
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include "base/mac/bundle_locations.h"
|
#include "base/mac/bundle_locations.h"
|
||||||
#include "base/mac/foundation_util.h"
|
#include "base/mac/foundation_util.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
|
#include "services/device/public/cpp/geolocation/geolocation_manager_impl_mac.h"
|
||||||
#import "shell/browser/mac/electron_application.h"
|
#import "shell/browser/mac/electron_application.h"
|
||||||
#include "shell/browser/mac/electron_application_delegate.h"
|
#include "shell/browser/mac/electron_application_delegate.h"
|
||||||
#include "shell/common/electron_paths.h"
|
#include "shell/common/electron_paths.h"
|
||||||
|
@ -27,6 +28,8 @@ void ElectronBrowserMainParts::PreCreateMainMessageLoop() {
|
||||||
[[NSUserDefaults standardUserDefaults]
|
[[NSUserDefaults standardUserDefaults]
|
||||||
setObject:@"NO"
|
setObject:@"NO"
|
||||||
forKey:@"NSTreatUnknownArgumentsAsOpen"];
|
forKey:@"NSTreatUnknownArgumentsAsOpen"];
|
||||||
|
|
||||||
|
geolocation_manager_ = device::GeolocationManagerImpl::Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElectronBrowserMainParts::FreeAppDelegate() {
|
void ElectronBrowserMainParts::FreeAppDelegate() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue