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

Unified Diff: chrome/browser/ui/views/wrench_menu.cc

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: chrome/browser/ui/views/wrench_menu.cc
diff --git a/chrome/browser/ui/views/wrench_menu.cc b/chrome/browser/ui/views/wrench_menu.cc
index ab5c200f552d99795c0e36c383ec716d2dc0fc7d..1eafa19eb1edfa802ca15ca10016f89e80fec988 100644
--- a/chrome/browser/ui/views/wrench_menu.cc
+++ b/chrome/browser/ui/views/wrench_menu.cc
@@ -481,7 +481,7 @@ static const int kTouchZoomPadding = 14;
// the zoom, a label showing the current zoom percent, and a button to go
// full-screen.
class WrenchMenu::ZoomView : public WrenchMenuView,
- public content::NotificationObserver {
+ public content::HostZoomMap::Observer {
public:
ZoomView(WrenchMenu* menu,
MenuModel* menu_model,
@@ -489,6 +489,8 @@ class WrenchMenu::ZoomView : public WrenchMenuView,
int increment_index,
int fullscreen_index)
: WrenchMenuView(menu, menu_model),
+ content::HostZoomMap::Observer(
+ HostZoomMap::GetForBrowserContext(menu->browser_->profile())),
fullscreen_index_(fullscreen_index),
increment_button_(NULL),
zoom_label_(NULL),
@@ -555,11 +557,6 @@ class WrenchMenu::ZoomView : public WrenchMenuView,
AddChildView(fullscreen_button_);
UpdateZoomControls();
-
- registrar_.Add(
- this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
- content::Source<HostZoomMap>(
- HostZoomMap::GetForBrowserContext(menu->browser_->profile())));
}
// Overridden from View.
@@ -613,11 +610,7 @@ class WrenchMenu::ZoomView : public WrenchMenuView,
}
}
- // Overridden from content::NotificationObserver.
- virtual void Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) OVERRIDE {
- DCHECK_EQ(content::NOTIFICATION_ZOOM_LEVEL_CHANGED, type);
+ virtual void OnZoomLevelChanged(const std::string& host) OVERRIDE {
UpdateZoomControls();
}

Powered by Google App Engine
This is Rietveld 408576698