diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-01-30 16:01:24 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-03-01 12:06:32 +0000 |
commit | a6e3b9113ba28fee9f705bb93cddaadfec43a917 (patch) | |
tree | 624d9f2463e3a641e757c054a502b6a5e6fb3f15 /src/core/content_browser_client_qt.cpp | |
parent | 70d3a577aeefb298df97028acc7018b745116e98 (diff) |
GeoLocation adaptations for Chromium 55
Restructures geolocation classes to fit new code
Change-Id: Ic370bd4cef4ba3f7c98931761d180fccd0b82cb7
Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'src/core/content_browser_client_qt.cpp')
-rw-r--r-- | src/core/content_browser_client_qt.cpp | 66 |
1 files changed, 26 insertions, 40 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 71e83a578..e305a4259 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -51,7 +51,6 @@ #include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/public/browser/browser_main_parts.h" #include "content/public/browser/child_process_security_policy.h" -#include "content/public/browser/geolocation_delegate.h" #include "content/public/browser/client_certificate_delegate.h" #include "content/public/browser/media_observer.h" #include "content/public/browser/quota_permission_context.h" @@ -63,6 +62,8 @@ #include "content/public/common/content_switches.h" #include "content/public/common/main_function_params.h" #include "content/public/common/url_constants.h" +#include "device/geolocation/geolocation_delegate.h" +#include "device/geolocation/geolocation_provider.h" #include "ui/base/ui_base_switches.h" #include "ui/display/screen.h" #include "ui/gl/gl_context.h" @@ -230,7 +231,29 @@ std::unique_ptr<base::MessagePump> messagePumpFactory() return base::WrapUnique(new MessagePumpForUIQt); } -} // namespace +// A provider of services needed by Geolocation. +class GeolocationDelegateQt : public device::GeolocationDelegate { +public: + GeolocationDelegateQt() {} + scoped_refptr<device::AccessTokenStore> CreateAccessTokenStore() final + { + return scoped_refptr<device::AccessTokenStore>(new AccessTokenStoreQt); + } + + std::unique_ptr<device::LocationProvider> OverrideSystemLocationProvider() final + { +#ifdef QT_USE_POSITIONING + return base::WrapUnique(new LocationProviderQt); +#else + return nullptr; +#endif + } + +private: + DISALLOW_COPY_AND_ASSIGN(GeolocationDelegateQt); +}; + +} // anonymous namespace class BrowserMainPartsQt : public content::BrowserMainParts { @@ -246,6 +269,7 @@ public: void PreMainMessageLoopRun() Q_DECL_OVERRIDE { + device::GeolocationProvider::SetGeolocationDelegate(new GeolocationDelegateQt()); } void PostMainMessageLoopRun() @@ -418,49 +442,11 @@ void ContentBrowserClientQt::OverrideWebkitPrefs(content::RenderViewHost *rvh, c static_cast<WebContentsDelegateQt*>(webContents->GetDelegate())->overrideWebPreferences(webContents, web_prefs); } -namespace { - -// A provider of services needed by Geolocation. -class GeolocationDelegateQt : public content::GeolocationDelegate { -public: - GeolocationDelegateQt() {} - content::AccessTokenStore* CreateAccessTokenStore() final - { - return new AccessTokenStoreQt; - } - - content::LocationProvider* OverrideSystemLocationProvider() final - { -#ifdef QT_USE_POSITIONING - if (!m_location_provider) - m_location_provider = base::WrapUnique(new LocationProviderQt); - return m_location_provider.get(); -#else - return nullptr; -#endif - } - -private: -#ifdef QT_USE_POSITIONING - std::unique_ptr<LocationProviderQt> m_location_provider; -#endif - - DISALLOW_COPY_AND_ASSIGN(GeolocationDelegateQt); -}; - -} // anonymous namespace - -content::GeolocationDelegate *ContentBrowserClientQt::CreateGeolocationDelegate() -{ - return new GeolocationDelegateQt; -} - content::QuotaPermissionContext *ContentBrowserClientQt::CreateQuotaPermissionContext() { return new QuotaPermissionContextQt; } - void ContentBrowserClientQt::AllowCertificateError(content::WebContents *webContents, int cert_error, const net::SSLInfo& ssl_info, |