Index: chrome/browser/extensions/api/tabs/tabs_api.h |
diff --git a/chrome/browser/extensions/api/tabs/tabs_api.h b/chrome/browser/extensions/api/tabs/tabs_api.h |
index fd45e377ccb2db92914b45bb7c836454fde4d04f..3284384456edbc88c009186339e8e93467e6ab45 100644 |
--- a/chrome/browser/extensions/api/tabs/tabs_api.h |
+++ b/chrome/browser/extensions/api/tabs/tabs_api.h |
@@ -12,6 +12,7 @@ |
#include "chrome/browser/extensions/api/capture_web_contents_function.h" |
#include "chrome/browser/extensions/api/execute_code_function.h" |
#include "chrome/browser/extensions/chrome_extension_function.h" |
+#include "chrome/browser/ui/zoom/zoom_controller.h" |
#include "chrome/common/extensions/api/tabs.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
@@ -41,6 +42,10 @@ class PrefRegistrySyncable; |
namespace extensions { |
+// Converts a ZoomMode to its ZoomSettings representation. |
+void ZoomModeToZoomSettings(ZoomController::ZoomMode zoom_mode, |
+ api::tabs::ZoomSettings* zoom_settings); |
+ |
// Windows |
class WindowsGetFunction : public ChromeSyncExtensionFunction { |
virtual ~WindowsGetFunction() {} |
@@ -254,6 +259,55 @@ class TabsInsertCSSFunction : public ExecuteCodeInTabFunction { |
DECLARE_EXTENSION_FUNCTION("tabs.insertCSS", TABS_INSERTCSS) |
}; |
+class ZoomAPIFunction : public ChromeAsyncExtensionFunction { |
+ protected: |
+ virtual ~ZoomAPIFunction() {} |
+ |
+ // Gets the WebContents for |tab_id| if it is specified. Otherwise get the |
+ // WebContents for the active tab in the current window. Calling this function |
+ // may set error_. |
+ // |
+ // TODO(...) many other tabs API functions use similar behavior. There should |
+ // be a way to share this implementation somehow. |
+ content::WebContents* GetWebContents(int tab_id); |
+}; |
+ |
+class TabsSetZoomFunction : public ZoomAPIFunction { |
+ private: |
+ virtual ~TabsSetZoomFunction() {} |
+ |
+ virtual bool RunAsync() OVERRIDE; |
+ |
+ DECLARE_EXTENSION_FUNCTION("tabs.setZoom", TABS_SETZOOM) |
+}; |
+ |
+class TabsGetZoomFunction : public ZoomAPIFunction { |
+ private: |
+ virtual ~TabsGetZoomFunction() {} |
+ |
+ virtual bool RunAsync() OVERRIDE; |
+ |
+ DECLARE_EXTENSION_FUNCTION("tabs.getZoom", TABS_GETZOOM) |
+}; |
+ |
+class TabsSetZoomSettingsFunction : public ZoomAPIFunction { |
+ private: |
+ virtual ~TabsSetZoomSettingsFunction() {} |
+ |
+ virtual bool RunAsync() OVERRIDE; |
+ |
+ DECLARE_EXTENSION_FUNCTION("tabs.setZoomSettings", TABS_SETZOOMSETTINGS) |
+}; |
+ |
+class TabsGetZoomSettingsFunction : public ZoomAPIFunction { |
+ private: |
+ virtual ~TabsGetZoomSettingsFunction() {} |
+ |
+ virtual bool RunAsync() OVERRIDE; |
+ |
+ DECLARE_EXTENSION_FUNCTION("tabs.getZoomSettings", TABS_GETZOOMSETTINGS) |
+}; |
+ |
} // namespace extensions |
#endif // CHROME_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ |