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 b64513cb6bfe9246a2ed77ccfcae0f4e02ba1abd..99dc6c174e960b45ae8dee06dece9b12c4f489cb 100644 |
--- a/chrome/browser/ui/views/wrench_menu.cc |
+++ b/chrome/browser/ui/views/wrench_menu.cc |
@@ -480,8 +480,7 @@ static const int kTouchZoomPadding = 14; |
// ZoomView contains the various zoom controls: two buttons to increase/decrease |
// the zoom, a label showing the current zoom percent, and a button to go |
// full-screen. |
-class WrenchMenu::ZoomView : public WrenchMenuView, |
- public content::NotificationObserver { |
+class WrenchMenu::ZoomView : public WrenchMenuView { |
public: |
ZoomView(WrenchMenu* menu, |
MenuModel* menu_model, |
@@ -495,6 +494,11 @@ class WrenchMenu::ZoomView : public WrenchMenuView, |
decrement_button_(NULL), |
fullscreen_button_(NULL), |
zoom_label_width_(0) { |
+ HostZoomMap::GetForBrowserContext( |
+ menu_->browser_->profile())->AddZoomLevelChangedCallback( |
+ base::Bind(&WrenchMenu::ZoomView::OnZoomLevelChanged, |
+ base::Unretained(this))); |
+ |
decrement_button_ = CreateButtonWithAccName( |
IDS_ZOOM_MINUS2, MenuButtonBackground::LEFT_BUTTON, decrement_index, |
NULL, IDS_ACCNAME_ZOOM_MINUS2); |
@@ -555,11 +559,13 @@ 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()))); |
+ ~ZoomView() { |
+ HostZoomMap::GetForBrowserContext( |
+ menu_->browser_->profile())->AddZoomLevelChangedCallback( |
+ base::Bind(&WrenchMenu::ZoomView::OnZoomLevelChanged, |
+ base::Unretained(this))); |
} |
// Overridden from View. |
@@ -613,11 +619,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); |
+ void OnZoomLevelChanged(const std::string& host) { |
UpdateZoomControls(); |
} |