summaryrefslogtreecommitdiffstats
path: root/src/core/content_browser_client_qt.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2016-08-01 16:19:34 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2016-09-14 08:15:39 +0000
commitf1e2b2d80366b43ba638290bca55272b000b3ce1 (patch)
tree9b3d4708f0cd80a1c73aeacdbf3b5640c7fa80ab /src/core/content_browser_client_qt.cpp
parentbaaab31631dcff6075418c95f0220e8fb207dd50 (diff)
Adaptations to Chromium 53
Change-Id: I15053486edfd42ee607250b4f14fb6eaa325c959 Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'src/core/content_browser_client_qt.cpp')
-rw-r--r--src/core/content_browser_client_qt.cpp70
1 files changed, 47 insertions, 23 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index 627544794..5131d8229 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -48,6 +48,7 @@
#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/media_observer.h"
#include "content/public/browser/quota_permission_context.h"
#include "content/public/browser/render_frame_host.h"
@@ -260,16 +261,16 @@ private:
DISALLOW_COPY_AND_ASSIGN(BrowserMainPartsQt);
};
-class QtShareGLContext : public gfx::GLContext {
+class QtShareGLContext : public gl::GLContext {
public:
QtShareGLContext(QOpenGLContext *qtContext)
- : gfx::GLContext(0)
+ : gl::GLContext(0)
, m_handle(0)
{
QString platform = qApp->platformName().toLower();
QPlatformNativeInterface *pni = QGuiApplication::platformNativeInterface();
if (platform == QLatin1String("xcb")) {
- if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2)
+ if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2)
m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext);
else
m_handle = pni->nativeResourceForContext(QByteArrayLiteral("glxcontext"), qtContext);
@@ -280,7 +281,7 @@ public:
else if (platform == QLatin1String("eglfs") || platform == QLatin1String("wayland"))
m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext);
else if (platform == QLatin1String("windows")) {
- if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2)
+ if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2)
m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglContext"), qtContext);
else
m_handle = pni->nativeResourceForContext(QByteArrayLiteral("renderingcontext"), qtContext);
@@ -296,12 +297,12 @@ public:
virtual bool WasAllocatedUsingRobustnessExtension() { return false; }
// We don't care about the rest, this context shouldn't be used except for its handle.
- virtual bool Initialize(gfx::GLSurface *, gfx::GpuPreference) Q_DECL_OVERRIDE { Q_UNREACHABLE(); return false; }
- virtual bool MakeCurrent(gfx::GLSurface *) Q_DECL_OVERRIDE { Q_UNREACHABLE(); return false; }
- virtual void ReleaseCurrent(gfx::GLSurface *) Q_DECL_OVERRIDE { Q_UNREACHABLE(); }
- virtual bool IsCurrent(gfx::GLSurface *) Q_DECL_OVERRIDE { Q_UNREACHABLE(); return false; }
+ virtual bool Initialize(gl::GLSurface *, gl::GpuPreference) Q_DECL_OVERRIDE { Q_UNREACHABLE(); return false; }
+ virtual bool MakeCurrent(gl::GLSurface *) Q_DECL_OVERRIDE { Q_UNREACHABLE(); return false; }
+ virtual void ReleaseCurrent(gl::GLSurface *) Q_DECL_OVERRIDE { Q_UNREACHABLE(); }
+ virtual bool IsCurrent(gl::GLSurface *) Q_DECL_OVERRIDE { Q_UNREACHABLE(); return false; }
virtual void OnSetSwapInterval(int) Q_DECL_OVERRIDE { Q_UNREACHABLE(); }
- virtual scoped_refptr<gfx::GPUTimingClient> CreateGPUTimingClient() Q_DECL_OVERRIDE
+ virtual scoped_refptr<gl::GPUTimingClient> CreateGPUTimingClient() Q_DECL_OVERRIDE
{
return nullptr;
}
@@ -310,9 +311,9 @@ private:
void *m_handle;
};
-class ShareGroupQtQuick : public gfx::GLShareGroup {
+class ShareGroupQtQuick : public gl::GLShareGroup {
public:
- virtual gfx::GLContext* GetContext() Q_DECL_OVERRIDE { return m_shareContextQtQuick.get(); }
+ virtual gl::GLContext* GetContext() Q_DECL_OVERRIDE { return m_shareContextQtQuick.get(); }
virtual void AboutToAddFirstContext() Q_DECL_OVERRIDE;
private:
@@ -385,7 +386,7 @@ void ContentBrowserClientQt::ResourceDispatcherHostCreated()
content::ResourceDispatcherHost::Get()->SetDelegate(m_resourceDispatcherHostDelegate.get());
}
-gfx::GLShareGroup *ContentBrowserClientQt::GetInProcessGpuShareGroup()
+gl::GLShareGroup *ContentBrowserClientQt::GetInProcessGpuShareGroup()
{
if (!m_shareGroupQtQuick.get())
m_shareGroupQtQuick = new ShareGroupQtQuick;
@@ -403,9 +404,41 @@ void ContentBrowserClientQt::OverrideWebkitPrefs(content::RenderViewHost *rvh, c
static_cast<WebContentsDelegateQt*>(webContents->GetDelegate())->overrideWebPreferences(webContents, web_prefs);
}
-content::AccessTokenStore *ContentBrowserClientQt::CreateAccessTokenStore()
+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 AccessTokenStoreQt;
+ return new GeolocationDelegateQt;
}
content::QuotaPermissionContext *ContentBrowserClientQt::CreateQuotaPermissionContext()
@@ -435,15 +468,6 @@ void ContentBrowserClientQt::AllowCertificateError(content::WebContents *webCont
*result = content::CERTIFICATE_REQUEST_RESULT_TYPE_DENY;
}
-content::LocationProvider *ContentBrowserClientQt::OverrideSystemLocationProvider()
-{
-#ifdef QT_USE_POSITIONING
- return new LocationProviderQt;
-#else
- return 0; // Leave it up to Chromium to figure something out.
-#endif
-}
-
std::string ContentBrowserClientQt::GetApplicationLocale()
{
return WebEngineLibraryInfo::getApplicationLocale();