Index: content/browser/devtools/protocol/security_handler.h |
diff --git a/content/browser/devtools/protocol/security_handler.h b/content/browser/devtools/protocol/security_handler.h |
index 136811a58f61e0ad2a05877aac12cd1ffeb66681..6dc5d252b2e226ef3cf12e283186ae1cbb54c0ab 100644 |
--- a/content/browser/devtools/protocol/security_handler.h |
+++ b/content/browser/devtools/protocol/security_handler.h |
@@ -5,9 +5,12 @@ |
#ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_ |
#define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_ |
+#include <unordered_map> |
+ |
#include "base/macros.h" |
#include "content/browser/devtools/protocol/devtools_domain_handler.h" |
#include "content/browser/devtools/protocol/security.h" |
+#include "content/public/browser/certificate_request_result_type.h" |
#include "content/public/browser/web_contents_observer.h" |
namespace content { |
@@ -21,27 +24,48 @@ class SecurityHandler : public DevToolsDomainHandler, |
public Security::Backend, |
public WebContentsObserver { |
public: |
+ using CertErrorCallback = |
+ base::Callback<void(content::CertificateRequestResultType)>; |
+ |
SecurityHandler(); |
~SecurityHandler() override; |
+ static SecurityHandler* FromAgentHost(DevToolsAgentHostImpl* host); |
+ |
+ // DevToolsDomainHandler overrides |
void Wire(UberDispatcher* dispatcher) override; |
void SetRenderFrameHost(RenderFrameHostImpl* host) override; |
- static SecurityHandler* FromAgentHost(DevToolsAgentHostImpl* host); |
- |
+ // Security::Backend overrides. |
Response Enable() override; |
Response Disable() override; |
Response ShowCertificateViewer() override; |
+ Response HandleCertificateError(int event_id, const String& action) override; |
+ Response SetOverrideCertificateErrors(bool override) override; |
+ |
+ // NotifyCertificateError will send a CertificateError event. The return |
+ // value indicates whether the error is expected to be handled by a |
estark
2017/03/09 00:24:31
nit: "Returns true if the error is expected to be
irisu
2017/03/13 01:56:56
Done.
|
+ // corresponding HandleCertificateError command. |
+ bool NotifyCertificateError(int cert_error, |
+ const GURL& request_url, |
+ CertErrorCallback callback); |
private: |
+ using CertErrorCallbackMap = std::unordered_map<int, CertErrorCallback>; |
+ |
void AttachToRenderFrameHost(); |
+ void FlushPendingCertificateErrorNotifications(); |
// WebContentsObserver overrides |
void DidChangeVisibleSecurityState() override; |
+ void DidFinishNavigation(NavigationHandle* navigation_handle) override; |
std::unique_ptr<Security::Frontend> frontend_; |
bool enabled_; |
RenderFrameHostImpl* host_; |
+ int last_cert_error_id_ = 0; |
+ CertErrorCallbackMap callbacks_; |
estark
2017/03/09 00:24:31
nit: perhaps call this |cert_error_callback_| to b
irisu
2017/03/13 01:56:56
Done.
|
+ bool certificate_errors_overriden_ = false; |
DISALLOW_COPY_AND_ASSIGN(SecurityHandler); |
}; |