OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "chrome/browser/ui/browser.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <shellapi.h> | 8 #include <shellapi.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif // OS_WIN | 10 #endif // OS_WIN |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 #include "chrome/browser/ui/window_sizer.h" | 90 #include "chrome/browser/ui/window_sizer.h" |
91 #include "chrome/browser/upgrade_detector.h" | 91 #include "chrome/browser/upgrade_detector.h" |
92 #include "chrome/browser/web_applications/web_app.h" | 92 #include "chrome/browser/web_applications/web_app.h" |
93 #include "chrome/common/chrome_constants.h" | 93 #include "chrome/common/chrome_constants.h" |
94 #include "chrome/common/chrome_switches.h" | 94 #include "chrome/common/chrome_switches.h" |
95 #include "chrome/common/content_restriction.h" | 95 #include "chrome/common/content_restriction.h" |
96 #include "chrome/common/extensions/extension.h" | 96 #include "chrome/common/extensions/extension.h" |
97 #include "chrome/common/notification_service.h" | 97 #include "chrome/common/notification_service.h" |
98 #include "chrome/common/page_transition_types.h" | 98 #include "chrome/common/page_transition_types.h" |
99 #include "chrome/common/pref_names.h" | 99 #include "chrome/common/pref_names.h" |
| 100 #include "chrome/common/profiling.h" |
100 #include "chrome/common/url_constants.h" | 101 #include "chrome/common/url_constants.h" |
101 #include "chrome/common/web_apps.h" | 102 #include "chrome/common/web_apps.h" |
102 #include "grit/chromium_strings.h" | 103 #include "grit/chromium_strings.h" |
103 #include "grit/generated_resources.h" | 104 #include "grit/generated_resources.h" |
104 #include "grit/locale_settings.h" | 105 #include "grit/locale_settings.h" |
105 #include "net/base/cookie_monster.h" | 106 #include "net/base/cookie_monster.h" |
106 #include "net/base/net_util.h" | 107 #include "net/base/net_util.h" |
107 #include "net/base/registry_controlled_domain.h" | 108 #include "net/base/registry_controlled_domain.h" |
108 #include "net/base/static_cookie_policy.h" | 109 #include "net/base/static_cookie_policy.h" |
109 #include "net/url_request/url_request_context.h" | 110 #include "net/url_request/url_request_context.h" |
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui); | 1150 command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui); |
1150 command_updater_.UpdateCommandEnabled(IDC_SYNC_BOOKMARKS, | 1151 command_updater_.UpdateCommandEnabled(IDC_SYNC_BOOKMARKS, |
1151 show_main_ui && profile_->IsSyncAccessible()); | 1152 show_main_ui && profile_->IsSyncAccessible()); |
1152 | 1153 |
1153 command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui); | 1154 command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui); |
1154 command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui); | 1155 command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui); |
1155 command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui); | 1156 command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui); |
1156 command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui); | 1157 command_updater_.UpdateCommandEnabled(IDC_ABOUT, show_main_ui); |
1157 command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, show_main_ui); | 1158 command_updater_.UpdateCommandEnabled(IDC_SHOW_APP_MENU, show_main_ui); |
1158 command_updater_.UpdateCommandEnabled(IDC_TOGGLE_VERTICAL_TABS, show_main_ui); | 1159 command_updater_.UpdateCommandEnabled(IDC_TOGGLE_VERTICAL_TABS, show_main_ui); |
| 1160 #if defined (ENABLE_PROFILING) && !defined(NO_TCMALLOC) |
| 1161 command_updater_.UpdateCommandEnabled(IDC_PROFILING_ENABLED, show_main_ui); |
| 1162 #endif |
1159 } | 1163 } |
1160 | 1164 |
1161 /////////////////////////////////////////////////////////////////////////////// | 1165 /////////////////////////////////////////////////////////////////////////////// |
1162 // Browser, Assorted browser commands: | 1166 // Browser, Assorted browser commands: |
1163 | 1167 |
1164 bool Browser::ShouldOpenNewTabForWindowDisposition( | 1168 bool Browser::ShouldOpenNewTabForWindowDisposition( |
1165 WindowOpenDisposition disposition) { | 1169 WindowOpenDisposition disposition) { |
1166 return (disposition == NEW_FOREGROUND_TAB || | 1170 return (disposition == NEW_FOREGROUND_TAB || |
1167 disposition == NEW_BACKGROUND_TAB); | 1171 disposition == NEW_BACKGROUND_TAB); |
1168 } | 1172 } |
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2253 DEVTOOLS_TOGGLE_ACTION_SHOW_CONSOLE); | 2257 DEVTOOLS_TOGGLE_ACTION_SHOW_CONSOLE); |
2254 break; | 2258 break; |
2255 case IDC_DEV_TOOLS_INSPECT: ToggleDevToolsWindow( | 2259 case IDC_DEV_TOOLS_INSPECT: ToggleDevToolsWindow( |
2256 DEVTOOLS_TOGGLE_ACTION_INSPECT); | 2260 DEVTOOLS_TOGGLE_ACTION_INSPECT); |
2257 break; | 2261 break; |
2258 case IDC_TASK_MANAGER: // fall through to OpenTaskManager(). | 2262 case IDC_TASK_MANAGER: // fall through to OpenTaskManager(). |
2259 case IDC_VIEW_BACKGROUND_PAGES: OpenTaskManager(); break; | 2263 case IDC_VIEW_BACKGROUND_PAGES: OpenTaskManager(); break; |
2260 case IDC_FEEDBACK: OpenBugReportDialog(); break; | 2264 case IDC_FEEDBACK: OpenBugReportDialog(); break; |
2261 | 2265 |
2262 case IDC_SHOW_BOOKMARK_BAR: ToggleBookmarkBar(); break; | 2266 case IDC_SHOW_BOOKMARK_BAR: ToggleBookmarkBar(); break; |
| 2267 case IDC_PROFILING_ENABLED: Profiling::Toggle(); break; |
2263 | 2268 |
2264 case IDC_SHOW_BOOKMARK_MANAGER: OpenBookmarkManager(); break; | 2269 case IDC_SHOW_BOOKMARK_MANAGER: OpenBookmarkManager(); break; |
2265 case IDC_SHOW_APP_MENU: ShowAppMenu(); break; | 2270 case IDC_SHOW_APP_MENU: ShowAppMenu(); break; |
2266 case IDC_SHOW_HISTORY: ShowHistoryTab(); break; | 2271 case IDC_SHOW_HISTORY: ShowHistoryTab(); break; |
2267 case IDC_SHOW_DOWNLOADS: ShowDownloadsTab(); break; | 2272 case IDC_SHOW_DOWNLOADS: ShowDownloadsTab(); break; |
2268 case IDC_MANAGE_EXTENSIONS: ShowExtensionsTab(); break; | 2273 case IDC_MANAGE_EXTENSIONS: ShowExtensionsTab(); break; |
2269 case IDC_SYNC_BOOKMARKS: OpenSyncMyBookmarksDialog(); break; | 2274 case IDC_SYNC_BOOKMARKS: OpenSyncMyBookmarksDialog(); break; |
2270 case IDC_OPTIONS: OpenOptionsDialog(); break; | 2275 case IDC_OPTIONS: OpenOptionsDialog(); break; |
2271 case IDC_EDIT_SEARCH_ENGINES: OpenKeywordEditor(); break; | 2276 case IDC_EDIT_SEARCH_ENGINES: OpenKeywordEditor(); break; |
2272 case IDC_VIEW_PASSWORDS: OpenPasswordManager(); break; | 2277 case IDC_VIEW_PASSWORDS: OpenPasswordManager(); break; |
(...skipping 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4299 // The page transition below is only for the purpose of inserting the tab. | 4304 // The page transition below is only for the purpose of inserting the tab. |
4300 browser->AddTab(view_source_contents, PageTransition::LINK); | 4305 browser->AddTab(view_source_contents, PageTransition::LINK); |
4301 } | 4306 } |
4302 | 4307 |
4303 if (profile_->HasSessionService()) { | 4308 if (profile_->HasSessionService()) { |
4304 SessionService* session_service = profile_->GetSessionService(); | 4309 SessionService* session_service = profile_->GetSessionService(); |
4305 if (session_service) | 4310 if (session_service) |
4306 session_service->TabRestored(&view_source_contents->controller(), false); | 4311 session_service->TabRestored(&view_source_contents->controller(), false); |
4307 } | 4312 } |
4308 } | 4313 } |
OLD | NEW |