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 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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, CanZoomIn(contents)); |
1146 command_updater_.UpdateCommandEnabled(IDC_ZOOM_NORMAL, ActualSize(contents)); | |
1147 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, CanZoomOut(contents)); | 1146 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, CanZoomOut(contents)); |
1147 // Reset zoom is always enabled because it also resets page scale. | |
1148 command_updater_.UpdateCommandEnabled(IDC_ZOOM_NORMAL, true); | |
Avi (use Gerrit)
2015/02/26 20:16:58
Can we have it be enabled only if _either_ there i
ccameron
2015/02/26 20:23:06
That information is really deep the renderer and c
Nico
2015/02/26 20:35:22
You only need to send "is at no pinch" and "is at
| |
1148 } | 1149 } |
1149 | 1150 |
1150 void BrowserCommandController::UpdateCommandsForContentRestrictionState() { | 1151 void BrowserCommandController::UpdateCommandsForContentRestrictionState() { |
1151 int restrictions = GetContentRestrictions(browser_); | 1152 int restrictions = GetContentRestrictions(browser_); |
1152 | 1153 |
1153 command_updater_.UpdateCommandEnabled( | 1154 command_updater_.UpdateCommandEnabled( |
1154 IDC_COPY, !(restrictions & CONTENT_RESTRICTION_COPY)); | 1155 IDC_COPY, !(restrictions & CONTENT_RESTRICTION_COPY)); |
1155 command_updater_.UpdateCommandEnabled( | 1156 command_updater_.UpdateCommandEnabled( |
1156 IDC_CUT, !(restrictions & CONTENT_RESTRICTION_CUT)); | 1157 IDC_CUT, !(restrictions & CONTENT_RESTRICTION_CUT)); |
1157 command_updater_.UpdateCommandEnabled( | 1158 command_updater_.UpdateCommandEnabled( |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1353 | 1354 |
1354 BrowserWindow* BrowserCommandController::window() { | 1355 BrowserWindow* BrowserCommandController::window() { |
1355 return browser_->window(); | 1356 return browser_->window(); |
1356 } | 1357 } |
1357 | 1358 |
1358 Profile* BrowserCommandController::profile() { | 1359 Profile* BrowserCommandController::profile() { |
1359 return browser_->profile(); | 1360 return browser_->profile(); |
1360 } | 1361 } |
1361 | 1362 |
1362 } // namespace chrome | 1363 } // namespace chrome |
OLD | NEW |