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

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

Issue 232773011: Zoom Extension API (work in progress) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Took callbacks, zoom modes, and observer stuff out of content, and reimplemented similar functional… Created 6 years, 8 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
« no previous file with comments | « chrome/browser/chrome_page_zoom.cc ('k') | chrome/browser/extensions/api/tabs/tabs_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 BackingStore; 23 class BackingStore;
23 class GURL; 24 class GURL;
24 class SkBitmap; 25 class SkBitmap;
(...skipping 10 matching lines...) Expand all
35 namespace ui { 36 namespace ui {
36 class ListSelectionModel; 37 class ListSelectionModel;
37 } 38 }
38 39
39 namespace user_prefs { 40 namespace user_prefs {
40 class PrefRegistrySyncable; 41 class PrefRegistrySyncable;
41 } 42 }
42 43
43 namespace extensions { 44 namespace extensions {
44 45
46 // Converts a ZoomMode to its ZoomSettings representation.
47 void ZoomModeToZoomSettings(ZoomMode zoom_mode,
48 api::tabs::ZoomSettings* zoom_settings);
49
45 // Windows 50 // Windows
46 class WindowsGetFunction : public ChromeSyncExtensionFunction { 51 class WindowsGetFunction : public ChromeSyncExtensionFunction {
47 virtual ~WindowsGetFunction() {} 52 virtual ~WindowsGetFunction() {}
48 virtual bool RunImpl() OVERRIDE; 53 virtual bool RunImpl() OVERRIDE;
49 DECLARE_EXTENSION_FUNCTION("windows.get", WINDOWS_GET) 54 DECLARE_EXTENSION_FUNCTION("windows.get", WINDOWS_GET)
50 }; 55 };
51 class WindowsGetCurrentFunction : public ChromeSyncExtensionFunction { 56 class WindowsGetCurrentFunction : public ChromeSyncExtensionFunction {
52 virtual ~WindowsGetCurrentFunction() {} 57 virtual ~WindowsGetCurrentFunction() {}
53 virtual bool RunImpl() OVERRIDE; 58 virtual bool RunImpl() OVERRIDE;
54 DECLARE_EXTENSION_FUNCTION("windows.getCurrent", WINDOWS_GETCURRENT) 59 DECLARE_EXTENSION_FUNCTION("windows.getCurrent", WINDOWS_GETCURRENT)
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 255
251 class TabsInsertCSSFunction : public ExecuteCodeInTabFunction { 256 class TabsInsertCSSFunction : public ExecuteCodeInTabFunction {
252 private: 257 private:
253 virtual ~TabsInsertCSSFunction() {} 258 virtual ~TabsInsertCSSFunction() {}
254 259
255 virtual bool ShouldInsertCSS() const OVERRIDE; 260 virtual bool ShouldInsertCSS() const OVERRIDE;
256 261
257 DECLARE_EXTENSION_FUNCTION("tabs.insertCSS", TABS_INSERTCSS) 262 DECLARE_EXTENSION_FUNCTION("tabs.insertCSS", TABS_INSERTCSS)
258 }; 263 };
259 264
265 class ZoomAPIFunction : public ChromeAsyncExtensionFunction {
266 protected:
267 virtual ~ZoomAPIFunction() {}
268
269 // Gets the WebContents for |tab_id| if it is specified. Otherwise get the
270 // WebContents for the active tab in the current window.
271 //
272 // TODO(...) many other tabs API functions use similar behavior. There should
273 // be a way to share this implementation somehow.
274 bool GetWebContents(int* tab_id, content::WebContents** web_contents);
275 };
276
277 class TabsSetZoomFunction : public ZoomAPIFunction {
278 private:
279 virtual ~TabsSetZoomFunction() {}
280
281 virtual bool RunImpl() 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 RunImpl() 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 RunImpl() 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 RunImpl() OVERRIDE;
309
310 DECLARE_EXTENSION_FUNCTION("tabs.getZoomSettings", TABS_GETZOOMSETTINGS)
311 };
312
260 } // namespace extensions 313 } // namespace extensions
261 314
262 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ 315 #endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_
OLDNEW
« no previous file with comments | « chrome/browser/chrome_page_zoom.cc ('k') | chrome/browser/extensions/api/tabs/tabs_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698