diff options
Diffstat (limited to 'src/core/web_contents_delegate_qt.cpp')
-rw-r--r-- | src/core/web_contents_delegate_qt.cpp | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index f13621b99..5318cdf1b 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -60,7 +60,7 @@ #include "web_contents_view_qt.h" #include "web_engine_context.h" #include "web_engine_settings.h" - +#include "certificate_error_controller.h" #include "chrome/browser/custom_handlers/protocol_handler_registry_factory.h" #include "components/web_cache/browser/web_cache_manager.h" #include "content/browser/frame_host/render_frame_host_impl.h" @@ -233,7 +233,7 @@ QUrl WebContentsDelegateQt::url(content::WebContents* source) const { } void WebContentsDelegateQt::AddNewContents(content::WebContents* source, std::unique_ptr<content::WebContents> new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked) { - Q_UNUSED(source) + Q_UNUSED(source); QSharedPointer<WebContentsAdapter> newAdapter = createWindow(std::move(new_contents), disposition, initial_pos, user_gesture); // Chromium can forget to pass user-agent override settings to new windows (see QTBUG-61774 and QTBUG-76249), // so set it here. Note the actual value doesn't really matter here. Only the second value does, but we try @@ -336,6 +336,10 @@ void WebContentsDelegateQt::EmitLoadStarted(const QUrl &url, bool isErrorPage) { if (m_lastLoadProgress >= 0 && m_lastLoadProgress < 100) // already running return; + for (auto &&wc : m_certificateErrorControllers) + if (auto controller = wc.lock()) + controller->deactivate(); + m_certificateErrorControllers.clear(); m_viewClient->loadStarted(url, isErrorPage); m_viewClient->updateNavigationActions(); m_viewClient->loadProgressChanged(0); @@ -589,7 +593,7 @@ void WebContentsDelegateQt::RunFileChooser(content::RenderFrameHost * /*frameHos bool WebContentsDelegateQt::DidAddMessageToConsole(content::WebContents *source, blink::mojom::ConsoleMessageLevel log_level, const base::string16 &message, int32_t line_no, const base::string16 &source_id) { - Q_UNUSED(source) + Q_UNUSED(source); m_viewClient->javaScriptConsoleMessage(mapToJavascriptConsoleMessageLevel(log_level), toQt(message), static_cast<int>(line_no), toQt(source_id)); return false; } @@ -620,7 +624,7 @@ void WebContentsDelegateQt::SetContentsBounds(content::WebContents *source, cons void WebContentsDelegateQt::UpdateTargetURL(content::WebContents* source, const GURL& url) { - Q_UNUSED(source) + Q_UNUSED(source); m_viewClient->didUpdateTargetURL(toQt(url)); } @@ -674,9 +678,15 @@ WebContentsDelegateQt::createWindow(std::unique_ptr<content::WebContents> new_co toQt(initial_pos), m_initialTargetUrl); } -void WebContentsDelegateQt::allowCertificateError(const QSharedPointer<CertificateErrorController> &errorController) +void WebContentsDelegateQt::allowCertificateError( + const QSharedPointer<CertificateErrorController> &controller) { - m_viewClient->allowCertificateError(errorController); + QWebEngineCertificateError error(controller); + m_viewClient->allowCertificateError(error); + if (!error.isOverridable() || (!controller->deferred() && !controller->answered())) + error.rejectCertificate(); + else + m_certificateErrorControllers.append(controller); } void WebContentsDelegateQt::selectClientCert(const QSharedPointer<ClientCertSelectController> &selectController) |