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

Unified Diff: chrome/browser/ui/browser_command_controller.cc

Issue 310913002: Issue 32919: Update the Zoom NSMenuItems (Zoom-In/Zoom-out/Actual-Size) when the zoom state changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted zoom_controller_unittest.cc Created 6 years, 4 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/browser_command_controller.cc
diff --git a/chrome/browser/ui/browser_command_controller.cc b/chrome/browser/ui/browser_command_controller.cc
index 9ad358f8b0a4821070655184d386a20c195ae123..6aa4bd8c67bcbc24de05f95da25ea63cf0d6d0c5 100644
--- a/chrome/browser/ui/browser_command_controller.cc
+++ b/chrome/browser/ui/browser_command_controller.cc
@@ -318,6 +318,10 @@ void BrowserCommandController::TabStateChanged() {
UpdateCommandsForTabState();
}
+void BrowserCommandController::ZoomStateChanged() {
+ UpdateCommandsForZoomState();
+}
+
void BrowserCommandController::ContentRestrictionsChanged() {
UpdateCommandsForContentRestrictionState();
}
@@ -946,7 +950,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
@@ -1126,6 +1130,18 @@ void BrowserCommandController::UpdateCommandsForTabState() {
UpdateCommandsForContentRestrictionState();
UpdateCommandsForBookmarkEditing();
UpdateCommandsForFind();
+ // Update the zoom commands when an active tab is selected
Alexei Svitkine (slow) 2014/08/04 16:29:54 Nit: Add a . at the end of the sentence.
+ 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() {

Powered by Google App Engine
This is Rietveld 408576698