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

Unified Diff: content/browser/host_zoom_map_impl.h

Issue 224733018: Changes to content/ to facilitate new zoom extension API (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed Comments. 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
« no previous file with comments | « no previous file | content/browser/host_zoom_map_impl.cc » ('j') | content/browser/host_zoom_map_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/host_zoom_map_impl.h
diff --git a/content/browser/host_zoom_map_impl.h b/content/browser/host_zoom_map_impl.h
index 155f18e00fb2babd091a352d5df7b2b6974982ce..fa01c198a0818826b2e232942b6eb2ccf0c1e785 100644
--- a/content/browser/host_zoom_map_impl.h
+++ b/content/browser/host_zoom_map_impl.h
@@ -46,6 +46,10 @@ class CONTENT_EXPORT HostZoomMapImpl : public NON_EXPORTED_BASE(HostZoomMap),
virtual scoped_ptr<Subscription> AddZoomLevelChangedCallback(
const ZoomLevelChangedCallback& callback) OVERRIDE;
+ // Stores a callback to be called when the associated zoom change has
+ // completed.
+ void AddZoomCallback(int zoom_id, const base::Callback<void(void)>& callback);
+
// Returns the temporary zoom level that's only valid for the lifetime of
// the given WebContents (i.e. isn't saved and doesn't affect other
// WebContentses) if it exists, the default zoom level otherwise.
@@ -54,12 +58,20 @@ class CONTENT_EXPORT HostZoomMapImpl : public NON_EXPORTED_BASE(HostZoomMap),
double GetTemporaryZoomLevel(int render_process_id,
int render_view_id) const;
+ // Additionally calls the callback associated with the zoom ID |zoom_id|.
+ virtual void SetZoomLevelForHost(
+ const std::string& host,
+ int zoom_id,
+ double level);
+
// Sets the temporary zoom level that's only valid for the lifetime of this
// WebContents.
//
// This should only be called on the UI thread.
void SetTemporaryZoomLevel(int render_process_id,
int render_view_id,
+ const std::string& host,
+ int zoom_id,
double level);
// NotificationObserver implementation.
@@ -68,8 +80,22 @@ class CONTENT_EXPORT HostZoomMapImpl : public NON_EXPORTED_BASE(HostZoomMap),
const NotificationDetails& details) OVERRIDE;
private:
+ // Erases an entry in |temporary_zoom_levels_|.
+ void EraseTemporaryZoomLevel(int render_process_id, int render_view_id);
+
+ // Called when the zoom change with ID |zoom_id| has completed, and its
+ // associated callback should be called. Each callback can only be called
+ // once, and is removed from the |zoom_callback_map_| after calling.
+ void CallZoomCallback(int zoom_id);
+
double GetZoomLevelForHost(const std::string& host) const;
+ // Notifies the renderers from this browser context to change the zoom level
+ // for the specified host and scheme.
+ void SendZoomLevelChange(const std::string& scheme,
+ const std::string& host,
+ double level);
+
typedef std::map<std::string, double> HostZoomLevels;
typedef std::map<std::string, HostZoomLevels> SchemeHostZoomLevels;
@@ -92,6 +118,9 @@ class CONTENT_EXPORT HostZoomMapImpl : public NON_EXPORTED_BASE(HostZoomMap),
// level, so vector is fine for now.
std::vector<TemporaryZoomLevel> temporary_zoom_levels_;
+ // Stores callbacks to be called when the associated zoom changes complete.
+ std::map<int, base::Callback<void(void)> > zoom_callback_map_;
+
// Used around accesses to |host_zoom_levels_|, |default_zoom_level_| and
// |temporary_zoom_levels_| to guarantee thread safety.
mutable base::Lock lock_;
« no previous file with comments | « no previous file | content/browser/host_zoom_map_impl.cc » ('j') | content/browser/host_zoom_map_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698