Index: chrome/browser/ui/zoom/zoom_controller.h |
diff --git a/chrome/browser/ui/zoom/zoom_controller.h b/chrome/browser/ui/zoom/zoom_controller.h |
index 3c427a716d6956b4603ee54f1d1fe67dd4780985..b042b42acd5686a683e95c0ad0825cafff2a368c 100644 |
--- a/chrome/browser/ui/zoom/zoom_controller.h |
+++ b/chrome/browser/ui/zoom/zoom_controller.h |
@@ -11,6 +11,7 @@ |
#include "content/public/browser/host_zoom_map.h" |
#include "content/public/browser/web_contents_observer.h" |
#include "content/public/browser/web_contents_user_data.h" |
+#include "extensions/common/extension.h" |
class ZoomObserver; |
@@ -32,8 +33,17 @@ class ZoomController : public content::WebContentsObserver, |
// Returns which image should be loaded for the current zoom level. |
int GetResourceForZoomLevel() const; |
+ const extensions::Extension* last_extension() const; |
+ |
void set_observer(ZoomObserver* observer) { observer_ = observer; } |
+ // Sets the zoom level through WebContents::SetZoomLevel(). Returns a boolean |
+ // flag indicating success (true) or failure (false). |
+ bool SetZoomLevelByExtension( |
+ double zoom_level, |
+ scoped_refptr<const extensions::Extension> extension, |
+ const base::Callback<void(void)>& callback); |
+ |
// content::WebContentsObserver overrides: |
virtual void DidNavigateMainFrame( |
const content::LoadCommittedDetails& details, |
@@ -51,6 +61,12 @@ class ZoomController : public content::WebContentsObserver, |
// meaning the change should apply to ~all sites. If it is not empty, the |
// change only affects sites with the given host. |
void UpdateState(const std::string& host); |
+ void UpdateState(const std::string& host, bool is_temporary_zoom); |
+ |
+ // This function serves as a callback that will be called after a zoom |
+ // change has completed that is initiated from SetZoomLevelByExtension(). |
+ void ZoomCallback(scoped_refptr<const extensions::Extension> extension, |
+ const base::Callback<void(void)>& callback); |
// The current zoom percentage. |
int zoom_percent_; |
@@ -58,6 +74,14 @@ class ZoomController : public content::WebContentsObserver, |
// Used to access the default zoom level preference. |
DoublePrefMember default_zoom_level_; |
+ // Keeps track of the extension (if any) that initiated the last zoom change |
+ // that took effect. |
+ scoped_refptr<const extensions::Extension> last_extension_; |
+ |
+ // Temporary buffer that stores the extension (if any) that initiated the zoom |
+ // change that the ZoomController is about to be notified about. |
+ scoped_refptr<const extensions::Extension> pending_extension_; |
+ |
// Observer receiving notifications on state changes. |
ZoomObserver* observer_; |