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

Unified Diff: content/browser/host_zoom_map_impl.h

Issue 12039058: content: convert zoom notifications to observer usage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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: 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 7840188c0d747399cd59fbb42d0871237aafe74f..dcc9e4d7cdff34a8f5693c159e5635620a75a00f 100644
--- a/content/browser/host_zoom_map_impl.h
+++ b/content/browser/host_zoom_map_impl.h
@@ -10,6 +10,7 @@
#include <vector>
#include "base/compiler_specific.h"
+#include "base/observer_list.h"
#include "base/sequenced_task_runner_helpers.h"
#include "base/supports_user_data.h"
#include "base/synchronization/lock.h"
@@ -57,8 +58,19 @@ class CONTENT_EXPORT HostZoomMapImpl : public NON_EXPORTED_BASE(HostZoomMap),
const NotificationDetails& details) OVERRIDE;
private:
+ friend class HostZoomMap::Observer;
+
typedef std::map<std::string, double> HostZoomLevels;
+ // Add and remove observers. Adding or removing multiple times has no effect.
+ // The order in which notifications are sent to observers is undefined.
+ // Clients must be sure to remove the observer before they go away.
+ void AddObserver(HostZoomMap::Observer* observer);
+ void RemoveObserver(HostZoomMap::Observer* observer);
+
+ // A list of observers. Weak references.
+ ObserverList<HostZoomMap::Observer> observers_;
+
// Copy of the pref data, so that we can read it on the IO thread.
HostZoomLevels host_zoom_levels_;
double default_zoom_level_;

Powered by Google App Engine
This is Rietveld 408576698