| 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 1120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1131 UpdateCommandsForFind(); | 1131 UpdateCommandsForFind(); |
| 1132 // Update the zoom commands when an active tab is selected. | 1132 // Update the zoom commands when an active tab is selected. |
| 1133 UpdateCommandsForZoomState(); | 1133 UpdateCommandsForZoomState(); |
| 1134 } | 1134 } |
| 1135 | 1135 |
| 1136 void BrowserCommandController::UpdateCommandsForZoomState() { | 1136 void BrowserCommandController::UpdateCommandsForZoomState() { |
| 1137 WebContents* contents = | 1137 WebContents* contents = |
| 1138 browser_->tab_strip_model()->GetActiveWebContents(); | 1138 browser_->tab_strip_model()->GetActiveWebContents(); |
| 1139 if (!contents) | 1139 if (!contents) |
| 1140 return; | 1140 return; |
| 1141 command_updater_.UpdateCommandEnabled(IDC_ZOOM_PLUS, CanZoomIn(contents)); | 1141 command_updater_.UpdateCommandEnabled(IDC_ZOOM_PLUS, |
| 1142 command_updater_.UpdateCommandEnabled(IDC_ZOOM_NORMAL, ActualSize(contents)); | 1142 IsAtMaximumZoom(contents)); |
| 1143 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, CanZoomOut(contents)); | 1143 command_updater_.UpdateCommandEnabled(IDC_ZOOM_NORMAL, |
| 1144 !IsAtDefaultZoom(contents)); |
| 1145 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, |
| 1146 IsAtMinimumZoom(contents)); |
| 1144 } | 1147 } |
| 1145 | 1148 |
| 1146 void BrowserCommandController::UpdateCommandsForContentRestrictionState() { | 1149 void BrowserCommandController::UpdateCommandsForContentRestrictionState() { |
| 1147 int restrictions = GetContentRestrictions(browser_); | 1150 int restrictions = GetContentRestrictions(browser_); |
| 1148 | 1151 |
| 1149 command_updater_.UpdateCommandEnabled( | 1152 command_updater_.UpdateCommandEnabled( |
| 1150 IDC_COPY, !(restrictions & CONTENT_RESTRICTION_COPY)); | 1153 IDC_COPY, !(restrictions & CONTENT_RESTRICTION_COPY)); |
| 1151 command_updater_.UpdateCommandEnabled( | 1154 command_updater_.UpdateCommandEnabled( |
| 1152 IDC_CUT, !(restrictions & CONTENT_RESTRICTION_CUT)); | 1155 IDC_CUT, !(restrictions & CONTENT_RESTRICTION_CUT)); |
| 1153 command_updater_.UpdateCommandEnabled( | 1156 command_updater_.UpdateCommandEnabled( |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1348 | 1351 |
| 1349 BrowserWindow* BrowserCommandController::window() { | 1352 BrowserWindow* BrowserCommandController::window() { |
| 1350 return browser_->window(); | 1353 return browser_->window(); |
| 1351 } | 1354 } |
| 1352 | 1355 |
| 1353 Profile* BrowserCommandController::profile() { | 1356 Profile* BrowserCommandController::profile() { |
| 1354 return browser_->profile(); | 1357 return browser_->profile(); |
| 1355 } | 1358 } |
| 1356 | 1359 |
| 1357 } // namespace chrome | 1360 } // namespace chrome |
| OLD | NEW |