| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "chrome/browser/extensions/chrome_extension_function.h" | 12 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 13 #include "chrome/browser/extensions/chrome_extension_function_details.h" | 13 #include "chrome/browser/extensions/chrome_extension_function_details.h" |
| 14 #include "chrome/common/extensions/api/tabs.h" | 14 #include "chrome/common/extensions/api/tabs.h" |
| 15 #include "components/ui/zoom/zoom_controller.h" | 15 #include "components/ui/zoom/zoom_controller.h" |
| 16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
| 17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
| 18 #include "extensions/browser/api/capture_web_contents_function.h" | |
| 19 #include "extensions/browser/api/execute_code_function.h" | 18 #include "extensions/browser/api/execute_code_function.h" |
| 19 #include "extensions/browser/api/web_contents_capture_client.h" |
| 20 #include "extensions/common/extension_resource.h" | 20 #include "extensions/common/extension_resource.h" |
| 21 #include "extensions/common/user_script.h" | 21 #include "extensions/common/user_script.h" |
| 22 #include "url/gurl.h" | 22 #include "url/gurl.h" |
| 23 | 23 |
| 24 class GURL; | 24 class GURL; |
| 25 class SkBitmap; | 25 class SkBitmap; |
| 26 class TabStripModel; | 26 class TabStripModel; |
| 27 | 27 |
| 28 namespace base { | 28 namespace base { |
| 29 class DictionaryValue; | 29 class DictionaryValue; |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 ~TabsDetectLanguageFunction() override {} | 188 ~TabsDetectLanguageFunction() override {} |
| 189 bool RunAsync() override; | 189 bool RunAsync() override; |
| 190 | 190 |
| 191 void Observe(int type, | 191 void Observe(int type, |
| 192 const content::NotificationSource& source, | 192 const content::NotificationSource& source, |
| 193 const content::NotificationDetails& details) override; | 193 const content::NotificationDetails& details) override; |
| 194 void GotLanguage(const std::string& language); | 194 void GotLanguage(const std::string& language); |
| 195 content::NotificationRegistrar registrar_; | 195 content::NotificationRegistrar registrar_; |
| 196 DECLARE_EXTENSION_FUNCTION("tabs.detectLanguage", TABS_DETECTLANGUAGE) | 196 DECLARE_EXTENSION_FUNCTION("tabs.detectLanguage", TABS_DETECTLANGUAGE) |
| 197 }; | 197 }; |
| 198 |
| 198 class TabsCaptureVisibleTabFunction | 199 class TabsCaptureVisibleTabFunction |
| 199 : public extensions::CaptureWebContentsFunction { | 200 : public extensions::WebContentsCaptureClient, |
| 201 public AsyncExtensionFunction { |
| 200 public: | 202 public: |
| 201 TabsCaptureVisibleTabFunction(); | 203 TabsCaptureVisibleTabFunction(); |
| 202 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); | 204 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); |
| 203 | 205 |
| 206 // ExtensionFunction implementation. |
| 207 bool HasPermission() override; |
| 208 bool RunAsync() override; |
| 209 |
| 204 protected: | 210 protected: |
| 205 ~TabsCaptureVisibleTabFunction() override {} | 211 ~TabsCaptureVisibleTabFunction() override {} |
| 206 | 212 |
| 207 private: | 213 private: |
| 208 ChromeExtensionFunctionDetails chrome_details_; | 214 ChromeExtensionFunctionDetails chrome_details_; |
| 209 | 215 |
| 210 // extensions::CaptureWebContentsFunction: | 216 content::WebContents* GetWebContentsForID(int window_id); |
| 217 |
| 218 // extensions::WebContentsCaptureClient: |
| 211 bool IsScreenshotEnabled() override; | 219 bool IsScreenshotEnabled() override; |
| 212 content::WebContents* GetWebContentsForID(int id) override; | 220 void OnCaptureSuccess(const SkBitmap& bitmap) override; |
| 213 void OnCaptureFailure(FailureReason reason) override; | 221 void OnCaptureFailure(FailureReason reason) override; |
| 214 | 222 |
| 215 DECLARE_EXTENSION_FUNCTION("tabs.captureVisibleTab", TABS_CAPTUREVISIBLETAB) | 223 DECLARE_EXTENSION_FUNCTION("tabs.captureVisibleTab", TABS_CAPTUREVISIBLETAB) |
| 216 }; | 224 }; |
| 217 | 225 |
| 218 // Implement API call tabs.executeScript and tabs.insertCSS. | 226 // Implement API call tabs.executeScript and tabs.insertCSS. |
| 219 class ExecuteCodeInTabFunction : public ExecuteCodeFunction { | 227 class ExecuteCodeInTabFunction : public ExecuteCodeFunction { |
| 220 public: | 228 public: |
| 221 ExecuteCodeInTabFunction(); | 229 ExecuteCodeInTabFunction(); |
| 222 | 230 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 ~TabsGetZoomSettingsFunction() override {} | 317 ~TabsGetZoomSettingsFunction() override {} |
| 310 | 318 |
| 311 bool RunAsync() override; | 319 bool RunAsync() override; |
| 312 | 320 |
| 313 DECLARE_EXTENSION_FUNCTION("tabs.getZoomSettings", TABS_GETZOOMSETTINGS) | 321 DECLARE_EXTENSION_FUNCTION("tabs.getZoomSettings", TABS_GETZOOMSETTINGS) |
| 314 }; | 322 }; |
| 315 | 323 |
| 316 } // namespace extensions | 324 } // namespace extensions |
| 317 | 325 |
| 318 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ | 326 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ |
| OLD | NEW |