OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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_commands.h" | 5 #include "chrome/browser/ui/browser_commands.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 #include "content/public/common/url_utils.h" | 78 #include "content/public/common/url_utils.h" |
79 #include "content/public/common/user_agent.h" | 79 #include "content/public/common/user_agent.h" |
80 #include "extensions/browser/extension_registry.h" | 80 #include "extensions/browser/extension_registry.h" |
81 #include "extensions/common/extension.h" | 81 #include "extensions/common/extension.h" |
82 #include "extensions/common/extension_set.h" | 82 #include "extensions/common/extension_set.h" |
83 #include "net/base/escape.h" | 83 #include "net/base/escape.h" |
84 #include "ui/events/keycodes/keyboard_codes.h" | 84 #include "ui/events/keycodes/keyboard_codes.h" |
85 | 85 |
86 #if defined(OS_WIN) | 86 #if defined(OS_WIN) |
87 #include "chrome/browser/ui/metro_pin_tab_helper_win.h" | 87 #include "chrome/browser/ui/metro_pin_tab_helper_win.h" |
88 #include "win8/util/win8_util.h" | |
89 #endif | 88 #endif |
90 | 89 |
91 #if defined(ENABLE_PRINTING) | 90 #if defined(ENABLE_PRINTING) |
92 #if defined(ENABLE_FULL_PRINTING) | 91 #if defined(ENABLE_FULL_PRINTING) |
93 #include "chrome/browser/printing/print_preview_dialog_controller.h" | 92 #include "chrome/browser/printing/print_preview_dialog_controller.h" |
94 #include "chrome/browser/printing/print_view_manager.h" | 93 #include "chrome/browser/printing/print_view_manager.h" |
95 #else | 94 #else |
96 #include "chrome/browser/printing/print_view_manager_basic.h" | 95 #include "chrome/browser/printing/print_view_manager_basic.h" |
97 #endif // defined(ENABLE_FULL_PRINTING) | 96 #endif // defined(ENABLE_FULL_PRINTING) |
98 #endif // defined(ENABLE_PRINTING) | 97 #endif // defined(ENABLE_PRINTING) |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 extension_misc::APP_LAUNCH_OMNIBOX_LOCATION, | 527 extension_misc::APP_LAUNCH_OMNIBOX_LOCATION, |
529 extension->GetType()); | 528 extension->GetType()); |
530 } | 529 } |
531 } | 530 } |
532 | 531 |
533 void Stop(Browser* browser) { | 532 void Stop(Browser* browser) { |
534 content::RecordAction(UserMetricsAction("Stop")); | 533 content::RecordAction(UserMetricsAction("Stop")); |
535 browser->tab_strip_model()->GetActiveWebContents()->Stop(); | 534 browser->tab_strip_model()->GetActiveWebContents()->Stop(); |
536 } | 535 } |
537 | 536 |
538 #if !defined(OS_WIN) | |
539 void NewWindow(Browser* browser) { | 537 void NewWindow(Browser* browser) { |
540 NewEmptyWindow(browser->profile()->GetOriginalProfile(), | 538 NewEmptyWindow(browser->profile()->GetOriginalProfile(), |
541 browser->host_desktop_type()); | 539 browser->host_desktop_type()); |
542 } | 540 } |
543 | 541 |
544 void NewIncognitoWindow(Browser* browser) { | 542 void NewIncognitoWindow(Browser* browser) { |
545 NewEmptyWindow(browser->profile()->GetOffTheRecordProfile(), | 543 NewEmptyWindow(browser->profile()->GetOffTheRecordProfile(), |
546 browser->host_desktop_type()); | 544 browser->host_desktop_type()); |
547 } | 545 } |
548 #endif // OS_WIN | |
549 | 546 |
550 void CloseWindow(Browser* browser) { | 547 void CloseWindow(Browser* browser) { |
551 content::RecordAction(UserMetricsAction("CloseWindow")); | 548 content::RecordAction(UserMetricsAction("CloseWindow")); |
552 browser->window()->Close(); | 549 browser->window()->Close(); |
553 } | 550 } |
554 | 551 |
555 void NewTab(Browser* browser) { | 552 void NewTab(Browser* browser) { |
556 content::RecordAction(UserMetricsAction("NewTab")); | 553 content::RecordAction(UserMetricsAction("NewTab")); |
557 // TODO(asvitkine): This is invoked programmatically from several places. | 554 // TODO(asvitkine): This is invoked programmatically from several places. |
558 // Audit the code and change it so that the histogram only gets collected for | 555 // Audit the code and change it so that the histogram only gets collected for |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 void ToggleDevToolsWindow(Browser* browser, DevToolsToggleAction action) { | 1000 void ToggleDevToolsWindow(Browser* browser, DevToolsToggleAction action) { |
1004 if (action.type() == DevToolsToggleAction::kShowConsole) | 1001 if (action.type() == DevToolsToggleAction::kShowConsole) |
1005 content::RecordAction(UserMetricsAction("DevTools_ToggleConsole")); | 1002 content::RecordAction(UserMetricsAction("DevTools_ToggleConsole")); |
1006 else | 1003 else |
1007 content::RecordAction(UserMetricsAction("DevTools_ToggleWindow")); | 1004 content::RecordAction(UserMetricsAction("DevTools_ToggleWindow")); |
1008 DevToolsWindow::ToggleDevToolsWindow(browser, action); | 1005 DevToolsWindow::ToggleDevToolsWindow(browser, action); |
1009 } | 1006 } |
1010 | 1007 |
1011 bool CanOpenTaskManager() { | 1008 bool CanOpenTaskManager() { |
1012 #if defined(ENABLE_TASK_MANAGER) | 1009 #if defined(ENABLE_TASK_MANAGER) |
1013 #if defined(OS_WIN) | |
1014 // In metro we can't display the task manager, as it is a native window. | |
1015 return !win8::IsSingleWindowMetroMode(); | |
1016 #else | |
1017 return true; | 1010 return true; |
1018 #endif | |
1019 #else | 1011 #else |
1020 return false; | 1012 return false; |
1021 #endif | 1013 #endif |
1022 } | 1014 } |
1023 | 1015 |
1024 void OpenTaskManager(Browser* browser) { | 1016 void OpenTaskManager(Browser* browser) { |
1025 #if defined(ENABLE_TASK_MANAGER) | 1017 #if defined(ENABLE_TASK_MANAGER) |
1026 content::RecordAction(UserMetricsAction("TaskManager")); | 1018 content::RecordAction(UserMetricsAction("TaskManager")); |
1027 chrome::ShowTaskManager(browser); | 1019 chrome::ShowTaskManager(browser); |
1028 #else | 1020 #else |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1266 browser->profile(), | 1258 browser->profile(), |
1267 browser->host_desktop_type())); | 1259 browser->host_desktop_type())); |
1268 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1260 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1269 | 1261 |
1270 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1262 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1271 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1263 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1272 app_browser->window()->Show(); | 1264 app_browser->window()->Show(); |
1273 } | 1265 } |
1274 | 1266 |
1275 } // namespace chrome | 1267 } // namespace chrome |
OLD | NEW |