Sadrul Habib Chowdhury | 3377046 | 2017-09-26 20:36:19 | [diff] [blame] | 1 | // Copyright 2017 The Chromium Authors. All rights reserved. |
| 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_PAGE_HANDLER_H_ |
| 6 | #define CHROME_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ |
| 7 | |
| 8 | #include "chrome/browser/devtools/protocol/forward.h" |
| 9 | #include "chrome/browser/devtools/protocol/page.h" |
| 10 | #include "content/public/browser/web_contents_observer.h" |
| 11 | |
| 12 | namespace content { |
| 13 | class WebContents; |
| 14 | } |
| 15 | |
| 16 | class PageHandler : public protocol::Page::Backend, |
| 17 | public content::WebContentsObserver { |
| 18 | public: |
| 19 | PageHandler(content::WebContents* web_contents, |
| 20 | protocol::UberDispatcher* dispatcher); |
| 21 | ~PageHandler() override; |
| 22 | |
| 23 | void ToggleAdBlocking(bool enabled); |
| 24 | |
| 25 | // Page::Backend: |
| 26 | protocol::Response Enable() override; |
| 27 | protocol::Response Disable() override; |
| 28 | protocol::Response SetAdBlockingEnabled(bool enabled) override; |
Pavel Feldman | c9465362 | 2019-04-11 03:02:17 | [diff] [blame^] | 29 | void GetInstallabilityErrors( |
| 30 | std::unique_ptr<GetInstallabilityErrorsCallback> callback) override; |
Sadrul Habib Chowdhury | 3377046 | 2017-09-26 20:36:19 | [diff] [blame] | 31 | |
| 32 | private: |
Pavel Feldman | c9465362 | 2019-04-11 03:02:17 | [diff] [blame^] | 33 | static void GotInstallabilityErrors( |
| 34 | std::unique_ptr<GetInstallabilityErrorsCallback> callback, |
| 35 | std::vector<std::string> errors); |
| 36 | |
Sadrul Habib Chowdhury | 3377046 | 2017-09-26 20:36:19 | [diff] [blame] | 37 | bool enabled_ = false; |
| 38 | |
| 39 | DISALLOW_COPY_AND_ASSIGN(PageHandler); |
| 40 | }; |
| 41 | |
| 42 | #endif // CHROME_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ |