diff options
Diffstat (limited to 'src/core/content_browser_client_qt.cpp')
-rw-r--r-- | src/core/content_browser_client_qt.cpp | 149 |
1 files changed, 7 insertions, 142 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp index 05957c26f..1abf2387e 100644 --- a/src/core/content_browser_client_qt.cpp +++ b/src/core/content_browser_client_qt.cpp @@ -103,10 +103,6 @@ #include "third_party/blink/public/mojom/insecure_input/insecure_input_service.mojom.h" #include "ui/base/resource/resource_bundle.h" #include "ui/base/ui_base_switches.h" -#include "ui/gl/gl_context.h" -#include "ui/gl/gl_implementation.h" -#include "ui/gl/gl_share_group.h" -#include "ui/gl/gpu_timing.h" #include "url/url_util_qt.h" #include "qtwebengine/common/renderer_configuration.mojom.h" @@ -116,7 +112,6 @@ #include "browser_main_parts_qt.h" #include "browser_message_filter_qt.h" #include "certificate_error_controller.h" -#include "certificate_error_controller_p.h" #include "client_cert_select_controller.h" #include "devtools_manager_delegate_qt.h" #include "login_delegate_qt.h" @@ -145,7 +140,7 @@ #include "api/qwebenginecookiestore.h" #include "api/qwebenginecookiestore_p.h" #include "api/qwebengineurlscheme.h" - +#include "ozone/gl_share_context_qt.h" #if defined(Q_OS_LINUX) #include "global_descriptors_qt.h" #include "ui/base/resource/resource_bundle.h" @@ -186,15 +181,6 @@ #include <QGuiApplication> #include <QLocale> #include <QStandardPaths> -#if QT_CONFIG(opengl) -# include <QOpenGLContext> -# include <QOpenGLExtraFunctions> -#endif -#include <qpa/qplatformnativeinterface.h> - -QT_BEGIN_NAMESPACE -Q_GUI_EXPORT QOpenGLContext *qt_gl_global_share_context(); -QT_END_NAMESPACE // Implement IsHandledProtocol as declared in //url/url_util_qt.h. namespace url { @@ -235,93 +221,6 @@ bool IsHandledProtocol(base::StringPiece scheme) namespace QtWebEngineCore { -class QtShareGLContext : public gl::GLContext { -public: - QtShareGLContext(QOpenGLContext *qtContext) - : gl::GLContext(0) - , m_handle(0) - { - QString platform = qApp->platformName().toLower(); - QPlatformNativeInterface *pni = QGuiApplication::platformNativeInterface(); - if (platform == QLatin1String("xcb") || platform == QLatin1String("offscreen")) { - if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2) - m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext); - else - m_handle = pni->nativeResourceForContext(QByteArrayLiteral("glxcontext"), qtContext); - } else if (platform == QLatin1String("cocoa")) - m_handle = pni->nativeResourceForContext(QByteArrayLiteral("cglcontextobj"), qtContext); - else if (platform == QLatin1String("qnx")) - m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext); - else if (platform == QLatin1String("eglfs") || platform == QLatin1String("wayland") - || platform == QLatin1String("wayland-egl")) - m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglcontext"), qtContext); - else if (platform == QLatin1String("windows")) { - if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2) - m_handle = pni->nativeResourceForContext(QByteArrayLiteral("eglContext"), qtContext); - else - m_handle = pni->nativeResourceForContext(QByteArrayLiteral("renderingcontext"), qtContext); - } else { - qFatal("%s platform not yet supported", platform.toLatin1().constData()); - // Add missing platforms once they work. - Q_UNREACHABLE(); - } - } - - void* GetHandle() override { return m_handle; } - unsigned int CheckStickyGraphicsResetStatus() override - { -#if QT_CONFIG(opengl) - if (QOpenGLContext *context = qt_gl_global_share_context()) { - if (context->format().testOption(QSurfaceFormat::ResetNotification)) - return context->extraFunctions()->glGetGraphicsResetStatus(); - } -#endif - return 0 /*GL_NO_ERROR*/; - } - - // We don't care about the rest, this context shouldn't be used except for its handle. - bool Initialize(gl::GLSurface *, const gl::GLContextAttribs &) override { Q_UNREACHABLE(); return false; } - bool MakeCurrent(gl::GLSurface *) override { Q_UNREACHABLE(); return false; } - void ReleaseCurrent(gl::GLSurface *) override { Q_UNREACHABLE(); } - bool IsCurrent(gl::GLSurface *) override { Q_UNREACHABLE(); return false; } - scoped_refptr<gl::GPUTimingClient> CreateGPUTimingClient() override - { - return nullptr; - } - const gfx::ExtensionSet& GetExtensions() override - { - static const gfx::ExtensionSet s_emptySet; - return s_emptySet; - } - void ResetExtensions() override - { - } - -private: - void *m_handle; -}; - -class ShareGroupQtQuick : public gl::GLShareGroup { -public: - gl::GLContext* GetContext() override { return m_shareContextQtQuick.get(); } - void AboutToAddFirstContext() override; - -private: - scoped_refptr<QtShareGLContext> m_shareContextQtQuick; -}; - -void ShareGroupQtQuick::AboutToAddFirstContext() -{ -#if QT_CONFIG(opengl) - // This currently has to be setup by ::main in all applications using QQuickWebEngineView with delegated rendering. - QOpenGLContext *shareContext = qt_gl_global_share_context(); - if (!shareContext) { - qFatal("QWebEngine: OpenGL resource sharing is not set up in QtQuick. Please make sure to call QtWebEngine::initialize() in your main() function before QCoreApplication is created."); - } - m_shareContextQtQuick = new QtShareGLContext(shareContext); -#endif -} - ContentBrowserClientQt::ContentBrowserClientQt() { } @@ -366,9 +265,9 @@ void ContentBrowserClientQt::RenderProcessWillLaunch(content::RenderProcessHost gl::GLShareGroup *ContentBrowserClientQt::GetInProcessGpuShareGroup() { - if (!m_shareGroupQtQuick.get()) - m_shareGroupQtQuick = new ShareGroupQtQuick; - return m_shareGroupQtQuick.get(); + if (!m_shareGroupQt.get()) + m_shareGroupQt = new ShareGroupQt; + return m_shareGroupQt.get(); } content::MediaObserver *ContentBrowserClientQt::GetMediaObserver() @@ -402,52 +301,18 @@ void ContentBrowserClientQt::GetQuotaSettings(content::BrowserContext* context, storage::GetDefaultDeviceInfoHelper(), std::move(callback)); } -// Copied from chrome/browser/ssl/ssl_error_handler.cc: -static int IsCertErrorFatal(int cert_error) -{ - switch (cert_error) { - case net::ERR_CERT_COMMON_NAME_INVALID: - case net::ERR_CERT_DATE_INVALID: - case net::ERR_CERT_AUTHORITY_INVALID: - case net::ERR_CERT_WEAK_SIGNATURE_ALGORITHM: - case net::ERR_CERT_WEAK_KEY: - case net::ERR_CERT_NAME_CONSTRAINT_VIOLATION: - case net::ERR_CERT_VALIDITY_TOO_LONG: - case net::ERR_CERTIFICATE_TRANSPARENCY_REQUIRED: - case net::ERR_CERT_SYMANTEC_LEGACY: - return false; - case net::ERR_CERT_CONTAINS_ERRORS: - case net::ERR_CERT_REVOKED: - case net::ERR_CERT_INVALID: - case net::ERR_SSL_WEAK_SERVER_EPHEMERAL_DH_KEY: - case net::ERR_SSL_PINNED_KEY_NOT_IN_CERT_CHAIN: - return true; - default: - NOTREACHED(); - } - return true; -} - void ContentBrowserClientQt::AllowCertificateError(content::WebContents *webContents, int cert_error, const net::SSLInfo &ssl_info, const GURL &request_url, - bool is_main_frame_request, + bool /* is_main_frame_request */, bool strict_enforcement, base::OnceCallback<void(content::CertificateRequestResultType)> callback) { WebContentsDelegateQt* contentsDelegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate()); - QSharedPointer<CertificateErrorController> errorController( - new CertificateErrorController( - new CertificateErrorControllerPrivate( - cert_error, - ssl_info, - request_url, - is_main_frame_request, - IsCertErrorFatal(cert_error), - strict_enforcement, - std::move(callback)))); + QSharedPointer<CertificateErrorController> errorController(new CertificateErrorController( + cert_error, ssl_info, request_url, strict_enforcement, std::move(callback))); contentsDelegate->allowCertificateError(errorController); } |