OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/browser.h" | 5 #include "chrome/browser/browser.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "app/animation.h" | 10 #include "app/animation.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 #include "app/win_util.h" | 91 #include "app/win_util.h" |
92 #include "chrome/browser/browser_url_handler.h" | 92 #include "chrome/browser/browser_url_handler.h" |
93 #include "chrome/browser/cert_store.h" | 93 #include "chrome/browser/cert_store.h" |
94 #include "chrome/browser/child_process_host.h" | 94 #include "chrome/browser/child_process_host.h" |
95 #include "chrome/browser/download/save_package.h" | 95 #include "chrome/browser/download/save_package.h" |
96 #include "chrome/browser/ssl/ssl_error_info.h" | 96 #include "chrome/browser/ssl/ssl_error_info.h" |
97 #include "chrome/browser/shell_integration.h" | 97 #include "chrome/browser/shell_integration.h" |
98 #include "chrome/browser/task_manager.h" | 98 #include "chrome/browser/task_manager.h" |
99 #include "chrome/browser/user_data_manager.h" | 99 #include "chrome/browser/user_data_manager.h" |
100 #include "chrome/browser/view_ids.h" | 100 #include "chrome/browser/view_ids.h" |
| 101 #include "chrome/browser/views/app_launcher.h" |
101 #include "chrome/browser/views/location_bar_view.h" | 102 #include "chrome/browser/views/location_bar_view.h" |
102 #endif // OS_WIN | 103 #endif // OS_WIN |
103 | 104 |
104 #if defined(OS_MACOSX) | 105 #if defined(OS_MACOSX) |
105 #include "chrome/browser/cocoa/find_pasteboard.h" | 106 #include "chrome/browser/cocoa/find_pasteboard.h" |
106 #endif | 107 #endif |
107 | 108 |
108 using base::TimeDelta; | 109 using base::TimeDelta; |
109 | 110 |
110 // How long we wait before updating the browser chrome while loading a page. | 111 // How long we wait before updating the browser chrome while loading a page. |
(...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1024 #endif | 1025 #endif |
1025 } | 1026 } |
1026 | 1027 |
1027 void Browser::CloseWindow() { | 1028 void Browser::CloseWindow() { |
1028 UserMetrics::RecordAction("CloseWindow", profile_); | 1029 UserMetrics::RecordAction("CloseWindow", profile_); |
1029 window_->Close(); | 1030 window_->Close(); |
1030 } | 1031 } |
1031 | 1032 |
1032 void Browser::NewTab() { | 1033 void Browser::NewTab() { |
1033 UserMetrics::RecordAction("NewTab", profile_); | 1034 UserMetrics::RecordAction("NewTab", profile_); |
| 1035 #if defined(OS_WIN) |
| 1036 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 1037 switches::kAppLauncherForNewTab)) { |
| 1038 AppLauncher::Show(this); |
| 1039 return; |
| 1040 } |
| 1041 #endif |
1034 if (type() == TYPE_NORMAL) { | 1042 if (type() == TYPE_NORMAL) { |
1035 AddBlankTab(true); | 1043 AddBlankTab(true); |
1036 } else { | 1044 } else { |
1037 Browser* b = GetOrCreateTabbedBrowser(profile_); | 1045 Browser* b = GetOrCreateTabbedBrowser(profile_); |
1038 b->AddBlankTab(true); | 1046 b->AddBlankTab(true); |
1039 b->window()->Show(); | 1047 b->window()->Show(); |
1040 // The call to AddBlankTab above did not set the focus to the tab as its | 1048 // The call to AddBlankTab above did not set the focus to the tab as its |
1041 // window was not active, so we have to do it explicitly. | 1049 // window was not active, so we have to do it explicitly. |
1042 // See http://crbug.com/6380. | 1050 // See http://crbug.com/6380. |
1043 b->GetSelectedTabContents()->view()->RestoreFocus(); | 1051 b->GetSelectedTabContents()->view()->RestoreFocus(); |
(...skipping 2398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3442 if (TabHasUnloadListener(contents)) { | 3450 if (TabHasUnloadListener(contents)) { |
3443 // If the page has unload listeners, then we tell the renderer to fire | 3451 // If the page has unload listeners, then we tell the renderer to fire |
3444 // them. Once they have fired, we'll get a message back saying whether | 3452 // them. Once they have fired, we'll get a message back saying whether |
3445 // to proceed closing the page or not, which sends us back to this method | 3453 // to proceed closing the page or not, which sends us back to this method |
3446 // with the HasUnloadListener bit cleared. | 3454 // with the HasUnloadListener bit cleared. |
3447 contents->render_view_host()->FirePageBeforeUnload(false); | 3455 contents->render_view_host()->FirePageBeforeUnload(false); |
3448 return true; | 3456 return true; |
3449 } | 3457 } |
3450 return false; | 3458 return false; |
3451 } | 3459 } |
OLD | NEW |