Avi Drissman | 4a8573c | 2022-09-09 19:35:54 | [diff] [blame] | 1 | // Copyright 2019 The Chromium Authors |
Lorne Mitchell | e300b6ba | 2019-10-07 19:48:35 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_BROWSER_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_ |
| 6 | #define CHROME_BROWSER_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_ |
| 7 | |
Lorne Mitchell | e300b6ba | 2019-10-07 19:48:35 | [diff] [blame] | 8 | #include "chrome/browser/devtools/protocol/security.h" |
| 9 | #include "content/public/browser/web_contents_observer.h" |
| 10 | |
| 11 | namespace content { |
| 12 | class WebContents; |
| 13 | } // namespace content |
| 14 | |
| 15 | class SecurityHandler : public protocol::Security::Backend, |
| 16 | public content::WebContentsObserver { |
| 17 | public: |
| 18 | SecurityHandler(content::WebContents* web_contents, |
| 19 | protocol::UberDispatcher* dispatcher); |
Peter Boström | 53c6c595 | 2021-09-17 09:41:26 | [diff] [blame] | 20 | |
| 21 | SecurityHandler(const SecurityHandler&) = delete; |
| 22 | SecurityHandler& operator=(const SecurityHandler&) = delete; |
| 23 | |
Lorne Mitchell | e300b6ba | 2019-10-07 19:48:35 | [diff] [blame] | 24 | ~SecurityHandler() override; |
| 25 | |
| 26 | // Security::Backend: |
| 27 | protocol::Response Enable() override; |
| 28 | protocol::Response Disable() override; |
| 29 | |
| 30 | private: |
| 31 | // WebContentsObserver overrides |
| 32 | void DidChangeVisibleSecurityState() override; |
| 33 | |
| 34 | bool enabled_ = false; |
| 35 | std::unique_ptr<protocol::Security::Frontend> frontend_; |
Lorne Mitchell | e300b6ba | 2019-10-07 19:48:35 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | #endif // CHROME_BROWSER_DEVTOOLS_PROTOCOL_SECURITY_HANDLER_H_ |