| 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 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, CanZoomIn(contents)); |
| 1142 command_updater_.UpdateCommandEnabled(IDC_ZOOM_NORMAL, ActualSize(contents)); | 1142 command_updater_.UpdateCommandEnabled(IDC_ZOOM_NORMAL, |
| 1143 ActualSize(contents, browser_)); |
| 1143 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, CanZoomOut(contents)); | 1144 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, CanZoomOut(contents)); |
| 1144 } | 1145 } |
| 1145 | 1146 |
| 1146 void BrowserCommandController::UpdateCommandsForContentRestrictionState() { | 1147 void BrowserCommandController::UpdateCommandsForContentRestrictionState() { |
| 1147 int restrictions = GetContentRestrictions(browser_); | 1148 int restrictions = GetContentRestrictions(browser_); |
| 1148 | 1149 |
| 1149 command_updater_.UpdateCommandEnabled( | 1150 command_updater_.UpdateCommandEnabled( |
| 1150 IDC_COPY, !(restrictions & CONTENT_RESTRICTION_COPY)); | 1151 IDC_COPY, !(restrictions & CONTENT_RESTRICTION_COPY)); |
| 1151 command_updater_.UpdateCommandEnabled( | 1152 command_updater_.UpdateCommandEnabled( |
| 1152 IDC_CUT, !(restrictions & CONTENT_RESTRICTION_CUT)); | 1153 IDC_CUT, !(restrictions & CONTENT_RESTRICTION_CUT)); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1348 | 1349 |
| 1349 BrowserWindow* BrowserCommandController::window() { | 1350 BrowserWindow* BrowserCommandController::window() { |
| 1350 return browser_->window(); | 1351 return browser_->window(); |
| 1351 } | 1352 } |
| 1352 | 1353 |
| 1353 Profile* BrowserCommandController::profile() { | 1354 Profile* BrowserCommandController::profile() { |
| 1354 return browser_->profile(); | 1355 return browser_->profile(); |
| 1355 } | 1356 } |
| 1356 | 1357 |
| 1357 } // namespace chrome | 1358 } // namespace chrome |
| OLD | NEW |