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 "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
9 #include "chrome/browser/defaults.h" | 9 #include "chrome/browser/defaults.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 11 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
| 13 #include "chrome/browser/profiles/avatar_menu_model.h" |
13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
15 #include "chrome/browser/sessions/tab_restore_service.h" | 16 #include "chrome/browser/sessions/tab_restore_service.h" |
16 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 17 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
17 #include "chrome/browser/shell_integration.h" | 18 #include "chrome/browser/shell_integration.h" |
18 #include "chrome/browser/sync/profile_sync_service.h" | 19 #include "chrome/browser/sync/profile_sync_service.h" |
19 #include "chrome/browser/sync/profile_sync_service_factory.h" | 20 #include "chrome/browser/sync/profile_sync_service_factory.h" |
20 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 21 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
21 #include "chrome/browser/ui/browser.h" | 22 #include "chrome/browser/ui/browser.h" |
22 #include "chrome/browser/ui/browser_commands.h" | 23 #include "chrome/browser/ui/browser_commands.h" |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, fullscreen_enabled); | 1172 command_updater_.UpdateCommandEnabled(IDC_FULLSCREEN, fullscreen_enabled); |
1172 command_updater_.UpdateCommandEnabled(IDC_PRESENTATION_MODE, | 1173 command_updater_.UpdateCommandEnabled(IDC_PRESENTATION_MODE, |
1173 fullscreen_enabled); | 1174 fullscreen_enabled); |
1174 | 1175 |
1175 UpdateCommandsForBookmarkBar(); | 1176 UpdateCommandsForBookmarkBar(); |
1176 UpdateCommandsForMultipleProfiles(); | 1177 UpdateCommandsForMultipleProfiles(); |
1177 } | 1178 } |
1178 | 1179 |
1179 void BrowserCommandController::UpdateCommandsForMultipleProfiles() { | 1180 void BrowserCommandController::UpdateCommandsForMultipleProfiles() { |
1180 bool show_main_ui = IsShowingMainUI(window() && window()->IsFullscreen()); | 1181 bool show_main_ui = IsShowingMainUI(window() && window()->IsFullscreen()); |
1181 bool has_multiple_profiles = profile_manager_ && | 1182 bool enable = show_main_ui && |
1182 profile_manager_->GetNumberOfProfiles() > 1; | 1183 !profile()->IsOffTheRecord() && |
| 1184 profile_manager_ && |
| 1185 AvatarMenuModel::ShouldShowAvatarMenu(); |
1183 command_updater_.UpdateCommandEnabled(IDC_SHOW_AVATAR_MENU, | 1186 command_updater_.UpdateCommandEnabled(IDC_SHOW_AVATAR_MENU, |
1184 show_main_ui && | 1187 enable); |
1185 !profile()->IsOffTheRecord() && | |
1186 ProfileManager::IsMultipleProfilesEnabled() && | |
1187 has_multiple_profiles); | |
1188 } | 1188 } |
1189 | 1189 |
1190 void BrowserCommandController::UpdatePrintingState() { | 1190 void BrowserCommandController::UpdatePrintingState() { |
1191 bool print_enabled = CanPrint(browser_); | 1191 bool print_enabled = CanPrint(browser_); |
1192 command_updater_.UpdateCommandEnabled(IDC_PRINT, print_enabled); | 1192 command_updater_.UpdateCommandEnabled(IDC_PRINT, print_enabled); |
1193 command_updater_.UpdateCommandEnabled(IDC_ADVANCED_PRINT, | 1193 command_updater_.UpdateCommandEnabled(IDC_ADVANCED_PRINT, |
1194 CanAdvancedPrint(browser_)); | 1194 CanAdvancedPrint(browser_)); |
1195 command_updater_.UpdateCommandEnabled(IDC_PRINT_TO_DESTINATION, | 1195 command_updater_.UpdateCommandEnabled(IDC_PRINT_TO_DESTINATION, |
1196 print_enabled); | 1196 print_enabled); |
1197 #if defined(OS_WIN) | 1197 #if defined(OS_WIN) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1255 | 1255 |
1256 BrowserWindow* BrowserCommandController::window() { | 1256 BrowserWindow* BrowserCommandController::window() { |
1257 return browser_->window(); | 1257 return browser_->window(); |
1258 } | 1258 } |
1259 | 1259 |
1260 Profile* BrowserCommandController::profile() { | 1260 Profile* BrowserCommandController::profile() { |
1261 return browser_->profile(); | 1261 return browser_->profile(); |
1262 } | 1262 } |
1263 | 1263 |
1264 } // namespace chrome | 1264 } // namespace chrome |
OLD | NEW |