Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Unified Diff: content/browser/devtools/protocol/security_handler.h

Issue 2639203003: Add certificate error handling to devtools. (Closed)
Patch Set: Fix nits Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..e9085699966f79f1a0b243f7112f3eeb51afee91 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. Returns true if
+ // the error is expected to be handled by a corresponding
+ // HandleCertificateError command, and false otherwise.
+ 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 cert_error_callbacks_;
+ bool certificate_errors_overriden_ = false;
DISALLOW_COPY_AND_ASSIGN(SecurityHandler);
};

Powered by Google App Engine
This is Rietveld 408576698