OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/browser_command_controller.h" | 5 #include "chrome/browser/ui/browser_command_controller.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 UpdateCommandsForFind(); | 1135 UpdateCommandsForFind(); |
1136 // Update the zoom commands when an active tab is selected. | 1136 // Update the zoom commands when an active tab is selected. |
1137 UpdateCommandsForZoomState(); | 1137 UpdateCommandsForZoomState(); |
1138 } | 1138 } |
1139 | 1139 |
1140 void BrowserCommandController::UpdateCommandsForZoomState() { | 1140 void BrowserCommandController::UpdateCommandsForZoomState() { |
1141 WebContents* contents = | 1141 WebContents* contents = |
1142 browser_->tab_strip_model()->GetActiveWebContents(); | 1142 browser_->tab_strip_model()->GetActiveWebContents(); |
1143 if (!contents) | 1143 if (!contents) |
1144 return; | 1144 return; |
1145 command_updater_.UpdateCommandEnabled(IDC_ZOOM_PLUS, CanZoomIn(contents)); | 1145 command_updater_.UpdateCommandEnabled(IDC_ZOOM_PLUS, |
1146 command_updater_.UpdateCommandEnabled(IDC_ZOOM_NORMAL, ActualSize(contents)); | 1146 IsAtMaximumZoom(contents)); |
1147 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, CanZoomOut(contents)); | 1147 command_updater_.UpdateCommandEnabled(IDC_ZOOM_NORMAL, |
| 1148 !IsAtDefaultZoom(contents)); |
| 1149 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, |
| 1150 IsAtMinimumZoom(contents)); |
1148 } | 1151 } |
1149 | 1152 |
1150 void BrowserCommandController::UpdateCommandsForContentRestrictionState() { | 1153 void BrowserCommandController::UpdateCommandsForContentRestrictionState() { |
1151 int restrictions = GetContentRestrictions(browser_); | 1154 int restrictions = GetContentRestrictions(browser_); |
1152 | 1155 |
1153 command_updater_.UpdateCommandEnabled( | 1156 command_updater_.UpdateCommandEnabled( |
1154 IDC_COPY, !(restrictions & CONTENT_RESTRICTION_COPY)); | 1157 IDC_COPY, !(restrictions & CONTENT_RESTRICTION_COPY)); |
1155 command_updater_.UpdateCommandEnabled( | 1158 command_updater_.UpdateCommandEnabled( |
1156 IDC_CUT, !(restrictions & CONTENT_RESTRICTION_CUT)); | 1159 IDC_CUT, !(restrictions & CONTENT_RESTRICTION_CUT)); |
1157 command_updater_.UpdateCommandEnabled( | 1160 command_updater_.UpdateCommandEnabled( |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 | 1356 |
1354 BrowserWindow* BrowserCommandController::window() { | 1357 BrowserWindow* BrowserCommandController::window() { |
1355 return browser_->window(); | 1358 return browser_->window(); |
1356 } | 1359 } |
1357 | 1360 |
1358 Profile* BrowserCommandController::profile() { | 1361 Profile* BrowserCommandController::profile() { |
1359 return browser_->profile(); | 1362 return browser_->profile(); |
1360 } | 1363 } |
1361 | 1364 |
1362 } // namespace chrome | 1365 } // namespace chrome |
OLD | NEW |