diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-18 13:01:18 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2018-05-18 13:01:18 +0200 |
commit | ecc40a888c56bc529cea05a5501dd849c5d572c1 (patch) | |
tree | 2991d2188aae76632993682d272534e06605bb10 /src/core/content_browser_client_qt.cpp | |
parent | 216f19d52ce9e920349da9247afc2c8e85df2c56 (diff) | |
parent | 9233ac4b4cd22da400b0c94ca13b334c562582b9 (diff) |
Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: Id171407c17533846e8efe0e586d6793a61543438
Diffstat (limited to 'src/core/content_browser_client_qt.cpp')
-rw-r--r-- | src/core/content_browser_client_qt.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 6748fb956..aa13cce3a 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -53,6 +53,7 @@ #include "content/browser/renderer_host/render_view_host_delegate.h" #include "content/common/url_schemes.h" #include "content/public/browser/browser_main_parts.h" +#include "content/public/browser/browser_thread.h" #include "content/public/browser/child_process_security_policy.h" #include "content/public/browser/client_certificate_delegate.h" #include "content/public/browser/media_observer.h" @@ -67,6 +68,7 @@ #include "content/public/common/main_function_params.h" #include "content/public/common/service_names.mojom.h" #include "content/public/common/url_constants.h" +#include "device/geolocation/public/cpp/location_provider.h" #include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/binding_set.h" #include "printing/features/features.h" @@ -121,6 +123,10 @@ #include "renderer_host/pepper/pepper_host_factory_qt.h" #endif +#if defined(QT_USE_POSITIONING) +#include "location_provider_qt.h" +#endif + #include <QGuiApplication> #include <QLocale> #ifndef QT_NO_OPENGL @@ -723,6 +729,30 @@ bool ContentBrowserClientQt::CanCreateWindow( return (settings && settings->getJavaScriptCanOpenWindowsAutomatically()) || user_gesture; } +std::unique_ptr<device::LocationProvider> ContentBrowserClientQt::OverrideSystemLocationProvider() +{ +#if defined(QT_USE_POSITIONING) + return base::WrapUnique(new LocationProviderQt()); +#else + return nullptr; +#endif +} + +scoped_refptr<net::URLRequestContextGetter> GetSystemRequestContextOnUIThread() +{ + DCHECK_CURRENTLY_ON(content::BrowserThread::UI); + return scoped_refptr<net::URLRequestContextGetter>( + BrowserContextAdapter::defaultContext()->browserContext()->GetRequestContext()); +} + +void ContentBrowserClientQt::GetGeolocationRequestContext( + base::OnceCallback<void(scoped_refptr<net::URLRequestContextGetter>)> callback) +{ + content::BrowserThread::PostTaskAndReplyWithResult( + content::BrowserThread::UI, FROM_HERE, + base::BindOnce(&GetSystemRequestContextOnUIThread), std::move(callback)); +} + bool ContentBrowserClientQt::AllowGetCookie(const GURL &url, const GURL &first_party, const net::CookieList & /*cookie_list*/, |