OLD | NEW |
---|---|
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 RenderFrameHostImpl; | 18 class RenderFrameHostImpl; |
16 | 19 |
17 namespace protocol { | 20 namespace protocol { |
18 | 21 |
19 class SecurityHandler : public DevToolsDomainHandler, | 22 class SecurityHandler : public DevToolsDomainHandler, |
20 public Security::Backend, | 23 public Security::Backend, |
21 public WebContentsObserver { | 24 public WebContentsObserver { |
22 public: | 25 public: |
23 SecurityHandler(); | 26 SecurityHandler(); |
24 ~SecurityHandler() override; | 27 ~SecurityHandler() override; |
25 | 28 |
26 void Wire(UberDispatcher* dispatcher) override; | 29 void Wire(UberDispatcher* dispatcher) override; |
27 void SetRenderFrameHost(RenderFrameHostImpl* host) override; | 30 void SetRenderFrameHost(RenderFrameHostImpl* host) override; |
28 | 31 |
29 Response Enable() override; | 32 Response Enable() override; |
30 Response Disable() override; | 33 Response Disable() override; |
31 Response ShowCertificateViewer() override; | 34 Response ShowCertificateViewer() override; |
35 Response HandleCertificateError(int event_id, const String& action) override; | |
36 Response SetOverrideCertificateErrors(bool override) override; | |
32 | 37 |
33 private: | 38 private: |
34 void AttachToRenderFrameHost(); | 39 void AttachToRenderFrameHost(); |
35 | 40 |
41 using CertErrorCallbackMap = std::unordered_map<int, CertErrorCallback>; | |
42 | |
36 // WebContentsObserver overrides | 43 // WebContentsObserver overrides |
37 void DidChangeVisibleSecurityState() override; | 44 void DidChangeVisibleSecurityState() override; |
45 bool NotifyCertificateError(int cert_error, | |
46 const GURL& request_url, | |
47 CertErrorCallback callback) override; | |
38 | 48 |
39 std::unique_ptr<Security::Frontend> frontend_; | 49 std::unique_ptr<Security::Frontend> frontend_; |
40 bool enabled_; | 50 bool enabled_; |
41 RenderFrameHostImpl* host_; | 51 RenderFrameHostImpl* host_; |
52 int last_cert_error_id_; | |
pfeldman
2017/02/14 19:00:24
nit: you can now say = 0; here!
irisu
2017/02/16 00:24:30
Done.
| |
53 CertErrorCallbackMap callbacks_; | |
54 bool certificate_error_enabled_; | |
pfeldman
2017/02/14 19:00:24
nit: = false; !
irisu
2017/02/16 00:24:30
Done.
| |
42 | 55 |
43 DISALLOW_COPY_AND_ASSIGN(SecurityHandler); | 56 DISALLOW_COPY_AND_ASSIGN(SecurityHandler); |
44 }; | 57 }; |
45 | 58 |
46 } // namespace protocol | 59 } // namespace protocol |
47 } // namespace content | 60 } // namespace content |
48 | 61 |
49 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_ | 62 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_ |
OLD | NEW |