Chromium Code Reviews| 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 936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 947 command_updater_.UpdateCommandEnabled(IDC_ENCODING_WINDOWS1255, true); | 947 command_updater_.UpdateCommandEnabled(IDC_ENCODING_WINDOWS1255, true); |
| 948 command_updater_.UpdateCommandEnabled(IDC_ENCODING_WINDOWS1258, true); | 948 command_updater_.UpdateCommandEnabled(IDC_ENCODING_WINDOWS1258, true); |
| 949 | 949 |
| 950 // Zoom | 950 // Zoom |
| 951 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MENU, true); | 951 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MENU, true); |
| 952 command_updater_.UpdateCommandEnabled(IDC_ZOOM_PLUS, true); | 952 command_updater_.UpdateCommandEnabled(IDC_ZOOM_PLUS, true); |
| 953 command_updater_.UpdateCommandEnabled(IDC_ZOOM_NORMAL, false); | 953 command_updater_.UpdateCommandEnabled(IDC_ZOOM_NORMAL, false); |
| 954 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, true); | 954 command_updater_.UpdateCommandEnabled(IDC_ZOOM_MINUS, true); |
| 955 | 955 |
| 956 // Show various bits of UI | 956 // Show various bits of UI |
| 957 const bool guest_session = profile()->IsGuestSession(); | 957 const bool guest_session = profile()->IsGuestSession() || |
| 958 profile()->IsSystemProfile(); | |
|
msw
2015/05/21 04:34:43
Should this code instead [D]CHECK against this if
Mike Lerman
2015/05/21 15:27:31
What happens on Mac (or Linux I think) when there'
msw
2015/05/21 17:48:12
I'm not entirely sure. Outside tests, it looks lik
Mike Lerman
2015/05/21 19:24:33
DCHECK added.
| |
| 958 const bool normal_window = browser_->is_type_tabbed(); | 959 const bool normal_window = browser_->is_type_tabbed(); |
| 959 UpdateOpenFileState(&command_updater_); | 960 UpdateOpenFileState(&command_updater_); |
| 960 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, false); | 961 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, false); |
| 961 UpdateCommandsForDevTools(); | 962 UpdateCommandsForDevTools(); |
| 962 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, CanOpenTaskManager()); | 963 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, CanOpenTaskManager()); |
| 963 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, !guest_session); | 964 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, !guest_session); |
| 964 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); | 965 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); |
| 965 command_updater_.UpdateCommandEnabled(IDC_HELP_MENU, true); | 966 command_updater_.UpdateCommandEnabled(IDC_HELP_MENU, true); |
| 966 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE_VIA_KEYBOARD, true); | 967 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE_VIA_KEYBOARD, true); |
| 967 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE_VIA_MENU, true); | 968 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE_VIA_MENU, true); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1186 CanBookmarkAllTabs(browser_)); | 1187 CanBookmarkAllTabs(browser_)); |
| 1187 #if defined(OS_WIN) | 1188 #if defined(OS_WIN) |
| 1188 command_updater_.UpdateCommandEnabled(IDC_PIN_TO_START_SCREEN, true); | 1189 command_updater_.UpdateCommandEnabled(IDC_PIN_TO_START_SCREEN, true); |
| 1189 #endif | 1190 #endif |
| 1190 } | 1191 } |
| 1191 | 1192 |
| 1192 void BrowserCommandController::UpdateCommandsForBookmarkBar() { | 1193 void BrowserCommandController::UpdateCommandsForBookmarkBar() { |
| 1193 command_updater_.UpdateCommandEnabled( | 1194 command_updater_.UpdateCommandEnabled( |
| 1194 IDC_SHOW_BOOKMARK_BAR, | 1195 IDC_SHOW_BOOKMARK_BAR, |
| 1195 browser_defaults::bookmarks_enabled && !profile()->IsGuestSession() && | 1196 browser_defaults::bookmarks_enabled && !profile()->IsGuestSession() && |
| 1197 !profile()->IsGuestSession() && | |
|
msw
2015/05/21 04:34:43
ditto
Mike Lerman
2015/05/21 15:27:31
changed to system
| |
| 1196 !profile()->GetPrefs()->IsManagedPreference( | 1198 !profile()->GetPrefs()->IsManagedPreference( |
| 1197 bookmarks::prefs::kShowBookmarkBar) && | 1199 bookmarks::prefs::kShowBookmarkBar) && |
| 1198 IsShowingMainUI()); | 1200 IsShowingMainUI()); |
| 1199 } | 1201 } |
| 1200 | 1202 |
| 1201 void BrowserCommandController::UpdateCommandsForFileSelectionDialogs() { | 1203 void BrowserCommandController::UpdateCommandsForFileSelectionDialogs() { |
| 1202 UpdateSaveAsState(); | 1204 UpdateSaveAsState(); |
| 1203 UpdateOpenFileState(&command_updater_); | 1205 UpdateOpenFileState(&command_updater_); |
| 1204 } | 1206 } |
| 1205 | 1207 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1357 | 1359 |
| 1358 BrowserWindow* BrowserCommandController::window() { | 1360 BrowserWindow* BrowserCommandController::window() { |
| 1359 return browser_->window(); | 1361 return browser_->window(); |
| 1360 } | 1362 } |
| 1361 | 1363 |
| 1362 Profile* BrowserCommandController::profile() { | 1364 Profile* BrowserCommandController::profile() { |
| 1363 return browser_->profile(); | 1365 return browser_->profile(); |
| 1364 } | 1366 } |
| 1365 | 1367 |
| 1366 } // namespace chrome | 1368 } // namespace chrome |
| OLD | NEW |