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

Unified Diff: chrome/browser/ui/zoom/zoom_controller.h

Issue 225093019: Zoom Extension API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
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..c86d10f94ea7d7a07830e7a8a6294e9120450b90 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,19 @@ class ZoomController : public content::WebContentsObserver,
// Returns which image should be loaded for the current zoom level.
int GetResourceForZoomLevel() const;
+ // Gets an extensoin from |zoom_extension_map_| by zoom ID.
+ const extensions::Extension* GetExtensionById(int zoom_id) const;
+
+ int last_zoom_id() const;
+
void set_observer(ZoomObserver* observer) { observer_ = observer; }
+ // Sets the zoom level through WebContents::SetZoomLevel(), associates
+ // |extension| with that zoom change's zoom ID, and returns the zoom ID.
+ int SetZoomLevelByExtension(
+ double zoom_level,
+ scoped_refptr<const extensions::Extension> extension);
+
// content::WebContentsObserver overrides:
virtual void DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
@@ -51,6 +63,8 @@ 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, int zoom_id,
+ bool is_temporary_zoom);
// The current zoom percentage.
int zoom_percent_;
@@ -58,6 +72,14 @@ class ZoomController : public content::WebContentsObserver,
// Used to access the default zoom level preference.
DoublePrefMember default_zoom_level_;
+ // Used to keep track of which extensions initiated which zoom changes.
+ typedef std::map<int, scoped_refptr<
+ const extensions::Extension> > ZoomExtensionMap;
+ ZoomExtensionMap zoom_extension_map_;
+
+ // Keeps track of the zoom_id of the last zoom change that took effect.
+ int last_zoom_id_;
+
// Observer receiving notifications on state changes.
ZoomObserver* observer_;

Powered by Google App Engine
This is Rietveld 408576698