Index: chrome/browser/ui/browser_command_controller.cc |
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc |
index f32b8e076c8ae4e4f6de8c7f106c131f3f13dd74..d3de5c502f66a064b5d0a44a5ca2fcc28a04703d 100644 |
--- a/chrome/browser/ui/browser_command_controller.cc |
+++ b/chrome/browser/ui/browser_command_controller.cc |
@@ -317,6 +317,10 @@ void BrowserCommandController::TabStateChanged() { |
UpdateCommandsForTabState(); |
} |
+void BrowserCommandController::ZoomStateChanged() { |
+ UpdateCommandsForZoomState(); |
+} |
+ |
void BrowserCommandController::ContentRestrictionsChanged() { |
UpdateCommandsForContentRestrictionState(); |
} |
@@ -945,7 +949,7 @@ void BrowserCommandController::InitCommandState() { |
// Zoom |
command_updater_.UpdateCommandEnabled(IDC_ZOOM_MENU, true); |
command_updater_.UpdateCommandEnabled(IDC_ZOOM_PLUS, true); |
- command_updater_.UpdateCommandEnabled(IDC_ZOOM_NORMAL, true); |
+ command_updater_.UpdateCommandEnabled(IDC_ZOOM_NORMAL, false); |
command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, true); |
// Show various bits of UI |
@@ -1124,6 +1128,18 @@ void BrowserCommandController::UpdateCommandsForTabState() { |
UpdateCommandsForContentRestrictionState(); |
UpdateCommandsForBookmarkEditing(); |
UpdateCommandsForFind(); |
+ // Update the zoom commands when an active tab is selected |
+ UpdateCommandsForZoomState(); |
+} |
+ |
+void BrowserCommandController::UpdateCommandsForZoomState() { |
+ WebContents* contents = |
+ browser_->tab_strip_model()->GetActiveWebContents(); |
+ if (!contents) |
+ return; |
+ command_updater_.UpdateCommandEnabled(IDC_ZOOM_PLUS, CanZoomIn(contents)); |
+ command_updater_.UpdateCommandEnabled(IDC_ZOOM_NORMAL, ActualSize(contents)); |
+ command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, CanZoomOut(contents)); |
} |
void BrowserCommandController::UpdateCommandsForContentRestrictionState() { |