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" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/browser/defaults.h" | 12 #include "chrome/browser/defaults.h" |
13 #include "chrome/browser/extensions/extension_service.h" | 13 #include "chrome/browser/extensions/extension_service.h" |
14 #include "chrome/browser/extensions/extension_util.h" | 14 #include "chrome/browser/extensions/extension_util.h" |
15 #include "chrome/browser/lifetime/application_lifetime.h" | 15 #include "chrome/browser/lifetime/application_lifetime.h" |
16 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 16 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
18 #include "chrome/browser/profiles/profile_manager.h" | 18 #include "chrome/browser/profiles/profile_manager.h" |
19 #include "chrome/browser/sessions/tab_restore_service.h" | 19 #include "chrome/browser/sessions/tab_restore_service.h" |
20 #include "chrome/browser/sessions/tab_restore_service_factory.h" | 20 #include "chrome/browser/sessions/tab_restore_service_factory.h" |
21 #include "chrome/browser/shell_integration.h" | 21 #include "chrome/browser/shell_integration.h" |
22 #include "chrome/browser/signin/signin_promo.h" | 22 #include "chrome/browser/signin/signin_promo.h" |
23 #include "chrome/browser/sync/profile_sync_service.h" | 23 #include "chrome/browser/sync/profile_sync_service.h" |
24 #include "chrome/browser/sync/profile_sync_service_factory.h" | 24 #include "chrome/browser/sync/profile_sync_service_factory.h" |
25 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" | 25 #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" |
26 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
27 #include "chrome/browser/ui/browser_commands.h" | 27 #include "chrome/browser/ui/browser_commands.h" |
28 #include "chrome/browser/ui/browser_list.h" | |
28 #include "chrome/browser/ui/browser_window.h" | 29 #include "chrome/browser/ui/browser_window.h" |
29 #include "chrome/browser/ui/chrome_pages.h" | 30 #include "chrome/browser/ui/chrome_pages.h" |
30 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 31 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
31 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h" | 32 #include "chrome/browser/ui/tabs/tab_strip_model_utils.h" |
32 #include "chrome/browser/ui/webui/inspect_ui.h" | 33 #include "chrome/browser/ui/webui/inspect_ui.h" |
33 #include "chrome/common/chrome_switches.h" | 34 #include "chrome/common/chrome_switches.h" |
34 #include "chrome/common/content_restriction.h" | 35 #include "chrome/common/content_restriction.h" |
35 #include "chrome/common/pref_names.h" | 36 #include "chrome/common/pref_names.h" |
36 #include "chrome/common/profiling.h" | 37 #include "chrome/common/profiling.h" |
37 #include "content/public/browser/native_web_keyboard_event.h" | 38 #include "content/public/browser/native_web_keyboard_event.h" |
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1127 command_updater_.UpdateCommandEnabled(IDC_CREATE_HOSTED_APP, | 1128 command_updater_.UpdateCommandEnabled(IDC_CREATE_HOSTED_APP, |
1128 CanCreateBookmarkApp(browser_)); | 1129 CanCreateBookmarkApp(browser_)); |
1129 | 1130 |
1130 command_updater_.UpdateCommandEnabled( | 1131 command_updater_.UpdateCommandEnabled( |
1131 IDC_TOGGLE_REQUEST_TABLET_SITE, | 1132 IDC_TOGGLE_REQUEST_TABLET_SITE, |
1132 CanRequestTabletSite(current_web_contents)); | 1133 CanRequestTabletSite(current_web_contents)); |
1133 | 1134 |
1134 UpdateCommandsForContentRestrictionState(); | 1135 UpdateCommandsForContentRestrictionState(); |
1135 UpdateCommandsForBookmarkEditing(); | 1136 UpdateCommandsForBookmarkEditing(); |
1136 UpdateCommandsForFind(); | 1137 UpdateCommandsForFind(); |
1138 // Send browser observers that a tab state has changed. | |
1139 BrowserList::SetLastActive(browser_); | |
Avi (use Gerrit)
2015/05/15 16:13:08
Are the existing calls to SetLastActive not workin
sarka
2015/05/15 16:36:55
From what I understand not when a new tab is added
| |
1140 | |
1137 // Update the zoom commands when an active tab is selected. | 1141 // Update the zoom commands when an active tab is selected. |
1138 UpdateCommandsForZoomState(); | 1142 UpdateCommandsForZoomState(); |
1139 } | 1143 } |
1140 | 1144 |
1141 void BrowserCommandController::UpdateCommandsForZoomState() { | 1145 void BrowserCommandController::UpdateCommandsForZoomState() { |
1142 WebContents* contents = | 1146 WebContents* contents = |
1143 browser_->tab_strip_model()->GetActiveWebContents(); | 1147 browser_->tab_strip_model()->GetActiveWebContents(); |
1144 if (!contents) | 1148 if (!contents) |
1145 return; | 1149 return; |
1146 command_updater_.UpdateCommandEnabled(IDC_ZOOM_PLUS, | 1150 command_updater_.UpdateCommandEnabled(IDC_ZOOM_PLUS, |
(...skipping 210 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 |