| Index: chrome/browser/ui/gtk/browser_toolbar_gtk.cc
|
| diff --git a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc
|
| index 11e1b2b34b78916bd15475979e0b4f690ec2013a..84765b7a0520dbf7f1919028ff20b51ec5025420 100644
|
| --- a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc
|
| +++ b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc
|
| @@ -241,9 +241,8 @@ void BrowserToolbarGtk::Init(GtkWindow* top_level_window) {
|
| // The bookmark menu model needs to be able to force the wrench menu to close.
|
| wrench_menu_model_->bookmark_sub_menu_model()->SetMenuGtk(wrench_menu_.get());
|
|
|
| - registrar_.Add(this, content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
|
| - content::Source<HostZoomMap>(
|
| - HostZoomMap::GetForBrowserContext(profile)));
|
| + content::HostZoomMap::Observer::Observe(
|
| + HostZoomMap::GetForBrowserContext(profile));
|
|
|
| if (ShouldOnlyShowLocation()) {
|
| gtk_widget_show(event_box_);
|
| @@ -372,6 +371,21 @@ bool BrowserToolbarGtk::GetAcceleratorForCommandId(
|
| return true;
|
| }
|
|
|
| +// content::HostZoomMap::Observer ----------------------------------------------
|
| +
|
| +void BrowserToolbarGtk::OnZoomLevelChanged(const std::string& host) {
|
| + // Since BrowserToolbarGtk create a new |wrench_menu_model_| in
|
| + // RebuildWrenchMenu(), the ordering of the observers of HostZoomMap
|
| + // can change, and result in subtle bugs like http://crbug.com/118823.
|
| + // Rather than depending on the ordering of the observers, always update
|
| + // the WrenchMenuModel before updating the WrenchMenu.
|
| + wrench_menu_model_->UpdateZoomControls();
|
| +
|
| + // If our zoom level changed, we need to tell the menu to update its state,
|
| + // since the menu could still be open.
|
| + wrench_menu_->UpdateMenu();
|
| +}
|
| +
|
| // content::NotificationObserver -----------------------------------------------
|
|
|
| void BrowserToolbarGtk::Observe(int type,
|
| @@ -416,18 +430,6 @@ void BrowserToolbarGtk::Observe(int type,
|
| } else if (type == chrome::NOTIFICATION_GLOBAL_ERRORS_CHANGED) {
|
| is_wrench_menu_model_valid_ = false;
|
| gtk_widget_queue_draw(wrench_menu_button_->widget());
|
| - } else if (type == content::NOTIFICATION_ZOOM_LEVEL_CHANGED) {
|
| - // Since BrowserToolbarGtk create a new |wrench_menu_model_| in
|
| - // RebuildWrenchMenu(), the ordering of the observers of
|
| - // NOTIFICATION_ZOOM_LEVEL_CHANGED can change, and result in subtle bugs
|
| - // like http://crbug.com/118823. Rather than depending on the ordering
|
| - // of the notification observers, always update the WrenchMenuModel before
|
| - // updating the WrenchMenu.
|
| - wrench_menu_model_->UpdateZoomControls();
|
| -
|
| - // If our zoom level changed, we need to tell the menu to update its state,
|
| - // since the menu could still be open.
|
| - wrench_menu_->UpdateMenu();
|
| } else {
|
| NOTREACHED();
|
| }
|
|
|