| 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 EnableCertificateErrorHandling() 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(CertErrorCallback) override; |
| 38 | 46 |
| 39 std::unique_ptr<Security::Frontend> frontend_; | 47 std::unique_ptr<Security::Frontend> frontend_; |
| 40 bool enabled_; | 48 bool enabled_; |
| 41 RenderFrameHostImpl* host_; | 49 RenderFrameHostImpl* host_; |
| 50 int last_cert_error_id_; |
| 51 CertErrorCallbackMap callbacks_; |
| 52 bool certificate_error_enabled_; |
| 42 | 53 |
| 43 DISALLOW_COPY_AND_ASSIGN(SecurityHandler); | 54 DISALLOW_COPY_AND_ASSIGN(SecurityHandler); |
| 44 }; | 55 }; |
| 45 | 56 |
| 46 } // namespace protocol | 57 } // namespace protocol |
| 47 } // namespace content | 58 } // namespace content |
| 48 | 59 |
| 49 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_ | 60 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_ |
| OLD | NEW |