| 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..4f7c5d24cdbc3054cf39012d37f0afcc869d5b8d 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,22 +58,46 @@ 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);
|
|
|
| + // Erases the temporary zoom level stored for a WebContents.
|
| + //
|
| + // This should only be called on the UI thread.
|
| + void EraseTemporaryZoomLevel(int render_process_id, int render_view_id);
|
| +
|
| // NotificationObserver implementation.
|
| virtual void Observe(int type,
|
| const NotificationSource& source,
|
| const NotificationDetails& details) OVERRIDE;
|
|
|
| private:
|
| + // 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 +120,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_;
|
|
|