| 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(); |
| 959 DCHECK(!profile()->IsSystemProfile()) |
| 960 << "Ought to never have browser for the system profile."; |
| 958 const bool normal_window = browser_->is_type_tabbed(); | 961 const bool normal_window = browser_->is_type_tabbed(); |
| 959 UpdateOpenFileState(&command_updater_); | 962 UpdateOpenFileState(&command_updater_); |
| 960 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, false); | 963 command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, false); |
| 961 UpdateCommandsForDevTools(); | 964 UpdateCommandsForDevTools(); |
| 962 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, CanOpenTaskManager()); | 965 command_updater_.UpdateCommandEnabled(IDC_TASK_MANAGER, CanOpenTaskManager()); |
| 963 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, !guest_session); | 966 command_updater_.UpdateCommandEnabled(IDC_SHOW_HISTORY, !guest_session); |
| 964 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); | 967 command_updater_.UpdateCommandEnabled(IDC_SHOW_DOWNLOADS, true); |
| 965 command_updater_.UpdateCommandEnabled(IDC_HELP_MENU, true); | 968 command_updater_.UpdateCommandEnabled(IDC_HELP_MENU, true); |
| 966 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE_VIA_KEYBOARD, true); | 969 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE_VIA_KEYBOARD, true); |
| 967 command_updater_.UpdateCommandEnabled(IDC_HELP_PAGE_VIA_MENU, true); | 970 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_)); | 1189 CanBookmarkAllTabs(browser_)); |
| 1187 #if defined(OS_WIN) | 1190 #if defined(OS_WIN) |
| 1188 command_updater_.UpdateCommandEnabled(IDC_PIN_TO_START_SCREEN, true); | 1191 command_updater_.UpdateCommandEnabled(IDC_PIN_TO_START_SCREEN, true); |
| 1189 #endif | 1192 #endif |
| 1190 } | 1193 } |
| 1191 | 1194 |
| 1192 void BrowserCommandController::UpdateCommandsForBookmarkBar() { | 1195 void BrowserCommandController::UpdateCommandsForBookmarkBar() { |
| 1193 command_updater_.UpdateCommandEnabled( | 1196 command_updater_.UpdateCommandEnabled( |
| 1194 IDC_SHOW_BOOKMARK_BAR, | 1197 IDC_SHOW_BOOKMARK_BAR, |
| 1195 browser_defaults::bookmarks_enabled && !profile()->IsGuestSession() && | 1198 browser_defaults::bookmarks_enabled && !profile()->IsGuestSession() && |
| 1199 !profile()->IsSystemProfile() && |
| 1196 !profile()->GetPrefs()->IsManagedPreference( | 1200 !profile()->GetPrefs()->IsManagedPreference( |
| 1197 bookmarks::prefs::kShowBookmarkBar) && | 1201 bookmarks::prefs::kShowBookmarkBar) && |
| 1198 IsShowingMainUI()); | 1202 IsShowingMainUI()); |
| 1199 } | 1203 } |
| 1200 | 1204 |
| 1201 void BrowserCommandController::UpdateCommandsForFileSelectionDialogs() { | 1205 void BrowserCommandController::UpdateCommandsForFileSelectionDialogs() { |
| 1202 UpdateSaveAsState(); | 1206 UpdateSaveAsState(); |
| 1203 UpdateOpenFileState(&command_updater_); | 1207 UpdateOpenFileState(&command_updater_); |
| 1204 } | 1208 } |
| 1205 | 1209 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1357 | 1361 |
| 1358 BrowserWindow* BrowserCommandController::window() { | 1362 BrowserWindow* BrowserCommandController::window() { |
| 1359 return browser_->window(); | 1363 return browser_->window(); |
| 1360 } | 1364 } |
| 1361 | 1365 |
| 1362 Profile* BrowserCommandController::profile() { | 1366 Profile* BrowserCommandController::profile() { |
| 1363 return browser_->profile(); | 1367 return browser_->profile(); |
| 1364 } | 1368 } |
| 1365 | 1369 |
| 1366 } // namespace chrome | 1370 } // namespace chrome |
| OLD | NEW |