summaryrefslogtreecommitdiffstats
path: root/src/core/content_browser_client_qt.cpp
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@digia.com>2014-08-25 15:37:49 +0200
committerAllan Sandfeld Jensen <allan.jensen@digia.com>2014-08-29 14:47:12 +0200
commit66def056d0f0fc8794f622fcfd61f974fce2a3b1 (patch)
tree2f5276dc594e1e737fe4b6245ab96307439c04b3 /src/core/content_browser_client_qt.cpp
parent530ab16146b18457d0b3395ea64a6de756a4d22d (diff)
Add Qt WebEngine Widgets API for allowing certificate errors
This adds API for overriding some certificate errors. Once overridden any identical error for the same hostname and certificate will use the same override. Similar API for QtWebEngine QML should be added in a later patch. Change-Id: I144147b86d9b592e3f87346a1e48890acee0c670 Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'src/core/content_browser_client_qt.cpp')
-rw-r--r--src/core/content_browser_client_qt.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/core/content_browser_client_qt.cpp b/src/core/content_browser_client_qt.cpp
index aa404eced..f19199cc3 100644
--- a/src/core/content_browser_client_qt.cpp
+++ b/src/core/content_browser_client_qt.cpp
@@ -42,6 +42,7 @@
#include "content/public/browser/browser_main_parts.h"
#include "content/public/browser/child_process_security_policy.h"
#include "content/public/browser/media_observer.h"
+#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/resource_dispatcher_host.h"
@@ -54,6 +55,8 @@
#include "ui/gl/gl_share_group.h"
#include "browser_context_qt.h"
+#include "certificate_error_controller.h"
+#include "certificate_error_controller_p.h"
#include "desktop_screen_qt.h"
#include "dev_tools_http_handler_delegate_qt.h"
#include "media_capture_devices_dispatcher.h"
@@ -345,3 +348,22 @@ void ContentBrowserClientQt::enableInspector(bool enable)
m_devtools.reset();
}
}
+
+void ContentBrowserClientQt::AllowCertificateError(int render_process_id, int render_frame_id, int cert_error,
+ const net::SSLInfo& ssl_info, const GURL& request_url,
+ ResourceType::Type resource_type,
+ bool overridable, bool strict_enforcement,
+ const base::Callback<void(bool)>& callback,
+ content::CertificateRequestResultType* result)
+{
+ // We leave the result with its default value.
+ Q_UNUSED(result);
+
+ content::RenderFrameHost *frameHost = content::RenderFrameHost::FromID(render_process_id, render_frame_id);
+ WebContentsDelegateQt* contentsDelegate = 0;
+ if (content::WebContents *webContents = frameHost->GetRenderViewHost()->GetDelegate()->GetAsWebContents())
+ contentsDelegate = static_cast<WebContentsDelegateQt*>(webContents->GetDelegate());
+
+ QExplicitlySharedDataPointer<CertificateErrorController> errorController(new CertificateErrorController(new CertificateErrorControllerPrivate(cert_error, ssl_info, request_url, resource_type, overridable, strict_enforcement, callback)));
+ contentsDelegate->allowCertificateError(errorController);
+}