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 struct InstallabilityError; 14 class WebContents; 15 } 16 17 class SkBitmap; 18 19 class PageHandler : public protocol::Page::Backend, 20 public content::WebContentsObserver { 21 public: 22 PageHandler(content::WebContents* web_contents, 23 protocol::UberDispatcher* dispatcher); 24 ~PageHandler() override; 25 26 void ToggleAdBlocking(bool enabled); 27 28 // Page::Backend: 29 protocol::Response Enable() override; 30 protocol::Response Disable() override; 31 protocol::Response SetAdBlockingEnabled(bool enabled) override; 32 void GetInstallabilityErrors( 33 std::unique_ptr<GetInstallabilityErrorsCallback> callback) override; 34 35 void GetManifestIcons( 36 std::unique_ptr<GetManifestIconsCallback> callback) override; 37 38 private: 39 static void GotInstallabilityErrors( 40 std::unique_ptr<GetInstallabilityErrorsCallback> callback, 41 std::vector<content::InstallabilityError> installability_errors); 42 43 static void GotManifestIcons( 44 std::unique_ptr<GetManifestIconsCallback> callback, 45 const SkBitmap* primary_icon); 46 47 bool enabled_ = false; 48 49 DISALLOW_COPY_AND_ASSIGN(PageHandler); 50 }; 51 52 #endif // CHROME_BROWSER_DEVTOOLS_PROTOCOL_PAGE_HANDLER_H_ 53