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

Side by Side Diff: content/browser/devtools/protocol/security_handler.h

Issue 2639203003: Add certificate error handling to devtools. (Closed)
Patch Set: Fix tests with PlzNavigate 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_ 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_ 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_
7 7
8 #include <unordered_map>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "content/browser/devtools/protocol/devtools_domain_handler.h" 11 #include "content/browser/devtools/protocol/devtools_domain_handler.h"
10 #include "content/browser/devtools/protocol/security.h" 12 #include "content/browser/devtools/protocol/security.h"
13 #include "content/public/browser/certificate_request_result_type.h"
11 #include "content/public/browser/web_contents_observer.h" 14 #include "content/public/browser/web_contents_observer.h"
12 15
13 namespace content { 16 namespace content {
14 17
15 class DevToolsAgentHostImpl; 18 class DevToolsAgentHostImpl;
16 class RenderFrameHostImpl; 19 class RenderFrameHostImpl;
17 20
18 namespace protocol { 21 namespace protocol {
19 22
20 class SecurityHandler : public DevToolsDomainHandler, 23 class SecurityHandler : public DevToolsDomainHandler,
21 public Security::Backend, 24 public Security::Backend,
22 public WebContentsObserver { 25 public WebContentsObserver {
23 public: 26 public:
24 SecurityHandler(); 27 SecurityHandler();
25 ~SecurityHandler() override; 28 ~SecurityHandler() override;
26 29
27 void Wire(UberDispatcher* dispatcher) override; 30 void Wire(UberDispatcher* dispatcher) override;
28 void SetRenderFrameHost(RenderFrameHostImpl* host) override; 31 void SetRenderFrameHost(RenderFrameHostImpl* host) override;
29 32
30 static SecurityHandler* FromAgentHost(DevToolsAgentHostImpl* host); 33 static SecurityHandler* FromAgentHost(DevToolsAgentHostImpl* host);
31 34
32 Response Enable() override; 35 Response Enable() override;
estark 2017/02/28 23:34:01 optional nit: while you're here, if you wouldn't m
irisu 2017/03/06 11:56:49 Done.
33 Response Disable() override; 36 Response Disable() override;
34 Response ShowCertificateViewer() override; 37 Response ShowCertificateViewer() override;
38 Response HandleCertificateError(int event_id, const String& action) override;
39 Response SetOverrideCertificateErrors(bool override) override;
40
41 using CertErrorCallback =
estark 2017/02/28 23:34:01 per https://engdoc.corp.google.com/eng/doc/devguid
irisu 2017/03/06 11:56:49 Done.
42 base::Callback<void(content::CertificateRequestResultType)>;
43 using CertErrorCallbackMap = std::unordered_map<int, CertErrorCallback>;
estark 2017/02/28 23:34:01 this one could be private, right?
irisu 2017/03/06 11:56:49 Done.
44
45 bool NotifyCertificateError(int cert_error,
estark 2017/02/28 23:34:01 Please document (especially what the return value
irisu 2017/03/06 11:56:48 Done.
46 const GURL& request_url,
47 CertErrorCallback callback);
35 48
36 private: 49 private:
37 void AttachToRenderFrameHost(); 50 void AttachToRenderFrameHost();
51 void FlushPendingRequests();
estark 2017/02/28 23:34:01 nit: maybe FlushPendingCertificateErrorNotificatio
irisu 2017/03/06 11:56:49 Done.
38 52
39 // WebContentsObserver overrides 53 // WebContentsObserver overrides
40 void DidChangeVisibleSecurityState() override; 54 void DidChangeVisibleSecurityState() override;
55 void DidFinishNavigation(NavigationHandle* navigation_handle) override;
41 56
42 std::unique_ptr<Security::Frontend> frontend_; 57 std::unique_ptr<Security::Frontend> frontend_;
43 bool enabled_; 58 bool enabled_;
44 RenderFrameHostImpl* host_; 59 RenderFrameHostImpl* host_;
60 int last_cert_error_id_ = 0;
61 CertErrorCallbackMap callbacks_;
62 bool certificate_errors_overriden_ = false;
45 63
46 DISALLOW_COPY_AND_ASSIGN(SecurityHandler); 64 DISALLOW_COPY_AND_ASSIGN(SecurityHandler);
47 }; 65 };
48 66
49 } // namespace protocol 67 } // namespace protocol
50 } // namespace content 68 } // namespace content
51 69
52 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_ 70 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698