Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(679)

Side by Side Diff: chrome/browser/extensions/api/tabs/tabs_api.h

Issue 301733006: Zoom Extension API (chrome) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add event manager for manual zoom events. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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(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
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.
270 //
271 // TODO(...) many other tabs API functions use similar behavior. There should
272 // be a way to share this implementation somehow.
273 bool GetWebContents(int* tab_id, content::WebContents** web_contents);
274 };
275
276 class TabsSetZoomFunction : public ZoomAPIFunction {
277 private:
278 virtual ~TabsSetZoomFunction() {}
279
280 virtual bool RunAsync() OVERRIDE;
281
282 DECLARE_EXTENSION_FUNCTION("tabs.setZoom", TABS_SETZOOM)
283 };
284
285 class TabsGetZoomFunction : public ZoomAPIFunction {
286 private:
287 virtual ~TabsGetZoomFunction() {}
288
289 virtual bool RunAsync() OVERRIDE;
290
291 DECLARE_EXTENSION_FUNCTION("tabs.getZoom", TABS_GETZOOM)
292 };
293
294 class TabsSetZoomSettingsFunction : public ZoomAPIFunction {
295 private:
296 virtual ~TabsSetZoomSettingsFunction() {}
297
298 virtual bool RunAsync() OVERRIDE;
299
300 DECLARE_EXTENSION_FUNCTION("tabs.setZoomSettings", TABS_SETZOOMSETTINGS)
301 };
302
303 class TabsGetZoomSettingsFunction : public ZoomAPIFunction {
304 private:
305 virtual ~TabsGetZoomSettingsFunction() {}
306
307 virtual bool RunAsync() OVERRIDE;
308
309 DECLARE_EXTENSION_FUNCTION("tabs.getZoomSettings", TABS_GETZOOMSETTINGS)
310 };
311
259 } // namespace extensions 312 } // namespace extensions
260 313
261 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ 314 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698