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/api/capture_web_contents_function.h" | 12 #include "chrome/browser/extensions/api/capture_web_contents_function.h" |
13 #include "chrome/browser/extensions/api/execute_code_function.h" | 13 #include "chrome/browser/extensions/api/execute_code_function.h" |
14 #include "chrome/browser/extensions/chrome_extension_function.h" | 14 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 15 #include "chrome/browser/ui/zoom/zoom_controller.h" |
15 #include "chrome/common/extensions/api/tabs.h" | 16 #include "chrome/common/extensions/api/tabs.h" |
16 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
18 #include "extensions/common/extension_resource.h" | 19 #include "extensions/common/extension_resource.h" |
19 #include "extensions/common/user_script.h" | 20 #include "extensions/common/user_script.h" |
20 #include "url/gurl.h" | 21 #include "url/gurl.h" |
21 | 22 |
22 class GURL; | 23 class GURL; |
23 class SkBitmap; | 24 class SkBitmap; |
24 class TabStripModel; | 25 class TabStripModel; |
25 | 26 |
26 namespace base { | 27 namespace base { |
27 class DictionaryValue; | 28 class DictionaryValue; |
28 } | 29 } |
29 | 30 |
30 namespace content { | 31 namespace content { |
31 class WebContents; | 32 class WebContents; |
32 } | 33 } |
33 | 34 |
34 namespace ui { | 35 namespace ui { |
35 class ListSelectionModel; | 36 class ListSelectionModel; |
36 } | 37 } |
37 | 38 |
38 namespace user_prefs { | 39 namespace user_prefs { |
39 class PrefRegistrySyncable; | 40 class PrefRegistrySyncable; |
40 } | 41 } |
41 | 42 |
42 namespace extensions { | 43 namespace extensions { |
43 | 44 |
| 45 // Converts a ZoomMode to its ZoomSettings representation. |
| 46 void ZoomModeToZoomSettings(ZoomController::ZoomMode zoom_mode, |
| 47 api::tabs::ZoomSettings* zoom_settings); |
| 48 |
44 // Windows | 49 // Windows |
45 class WindowsGetFunction : public ChromeSyncExtensionFunction { | 50 class WindowsGetFunction : public ChromeSyncExtensionFunction { |
46 virtual ~WindowsGetFunction() {} | 51 virtual ~WindowsGetFunction() {} |
47 virtual bool RunSync() OVERRIDE; | 52 virtual bool RunSync() OVERRIDE; |
48 DECLARE_EXTENSION_FUNCTION("windows.get", WINDOWS_GET) | 53 DECLARE_EXTENSION_FUNCTION("windows.get", WINDOWS_GET) |
49 }; | 54 }; |
50 class WindowsGetCurrentFunction : public ChromeSyncExtensionFunction { | 55 class WindowsGetCurrentFunction : public ChromeSyncExtensionFunction { |
51 virtual ~WindowsGetCurrentFunction() {} | 56 virtual ~WindowsGetCurrentFunction() {} |
52 virtual bool RunSync() OVERRIDE; | 57 virtual bool RunSync() OVERRIDE; |
53 DECLARE_EXTENSION_FUNCTION("windows.getCurrent", WINDOWS_GETCURRENT) | 58 DECLARE_EXTENSION_FUNCTION("windows.getCurrent", WINDOWS_GETCURRENT) |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 254 |
250 class TabsInsertCSSFunction : public ExecuteCodeInTabFunction { | 255 class TabsInsertCSSFunction : public ExecuteCodeInTabFunction { |
251 private: | 256 private: |
252 virtual ~TabsInsertCSSFunction() {} | 257 virtual ~TabsInsertCSSFunction() {} |
253 | 258 |
254 virtual bool ShouldInsertCSS() const OVERRIDE; | 259 virtual bool ShouldInsertCSS() const OVERRIDE; |
255 | 260 |
256 DECLARE_EXTENSION_FUNCTION("tabs.insertCSS", TABS_INSERTCSS) | 261 DECLARE_EXTENSION_FUNCTION("tabs.insertCSS", TABS_INSERTCSS) |
257 }; | 262 }; |
258 | 263 |
| 264 class ZoomAPIFunction : public ChromeAsyncExtensionFunction { |
| 265 protected: |
| 266 virtual ~ZoomAPIFunction() {} |
| 267 |
| 268 // Gets the WebContents for |tab_id| if it is specified. Otherwise get the |
| 269 // WebContents for the active tab in the current window. Calling this function |
| 270 // may set error_. |
| 271 // |
| 272 // TODO(...) many other tabs API functions use similar behavior. There should |
| 273 // be a way to share this implementation somehow. |
| 274 content::WebContents* GetWebContents(int* tab_id); |
| 275 }; |
| 276 |
| 277 class TabsSetZoomFunction : public ZoomAPIFunction { |
| 278 private: |
| 279 virtual ~TabsSetZoomFunction() {} |
| 280 |
| 281 virtual bool RunAsync() OVERRIDE; |
| 282 |
| 283 DECLARE_EXTENSION_FUNCTION("tabs.setZoom", TABS_SETZOOM) |
| 284 }; |
| 285 |
| 286 class TabsGetZoomFunction : public ZoomAPIFunction { |
| 287 private: |
| 288 virtual ~TabsGetZoomFunction() {} |
| 289 |
| 290 virtual bool RunAsync() OVERRIDE; |
| 291 |
| 292 DECLARE_EXTENSION_FUNCTION("tabs.getZoom", TABS_GETZOOM) |
| 293 }; |
| 294 |
| 295 class TabsSetZoomSettingsFunction : public ZoomAPIFunction { |
| 296 private: |
| 297 virtual ~TabsSetZoomSettingsFunction() {} |
| 298 |
| 299 virtual bool RunAsync() OVERRIDE; |
| 300 |
| 301 DECLARE_EXTENSION_FUNCTION("tabs.setZoomSettings", TABS_SETZOOMSETTINGS) |
| 302 }; |
| 303 |
| 304 class TabsGetZoomSettingsFunction : public ZoomAPIFunction { |
| 305 private: |
| 306 virtual ~TabsGetZoomSettingsFunction() {} |
| 307 |
| 308 virtual bool RunAsync() OVERRIDE; |
| 309 |
| 310 DECLARE_EXTENSION_FUNCTION("tabs.getZoomSettings", TABS_GETZOOMSETTINGS) |
| 311 }; |
| 312 |
259 } // namespace extensions | 313 } // namespace extensions |
260 | 314 |
261 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ | 315 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ |
OLD | NEW |