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 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 void Browser::CloseWindow() { | 1026 void Browser::CloseWindow() { |
1027 UserMetrics::RecordAction(UserMetricsAction("CloseWindow"), profile_); | 1027 UserMetrics::RecordAction(UserMetricsAction("CloseWindow"), profile_); |
1028 window_->Close(); | 1028 window_->Close(); |
1029 } | 1029 } |
1030 | 1030 |
1031 void Browser::NewTab() { | 1031 void Browser::NewTab() { |
1032 UserMetrics::RecordAction(UserMetricsAction("NewTab"), profile_); | 1032 UserMetrics::RecordAction(UserMetricsAction("NewTab"), profile_); |
1033 #if defined(OS_WIN) | 1033 #if defined(OS_WIN) |
1034 if (CommandLine::ForCurrentProcess()->HasSwitch( | 1034 if (CommandLine::ForCurrentProcess()->HasSwitch( |
1035 switches::kAppLauncherForNewTab)) { | 1035 switches::kAppLauncherForNewTab)) { |
1036 AppLauncher::Show(this); | 1036 AppLauncher::ShowForNewTab(this); |
1037 return; | 1037 return; |
1038 } | 1038 } |
1039 #endif | 1039 #endif |
1040 if (type() == TYPE_NORMAL) { | 1040 if (type() == TYPE_NORMAL) { |
1041 AddBlankTab(true); | 1041 AddBlankTab(true); |
1042 } else { | 1042 } else { |
1043 Browser* b = GetOrCreateTabbedBrowser(profile_); | 1043 Browser* b = GetOrCreateTabbedBrowser(profile_); |
1044 b->AddBlankTab(true); | 1044 b->AddBlankTab(true); |
1045 b->window()->Show(); | 1045 b->window()->Show(); |
1046 // The call to AddBlankTab above did not set the focus to the tab as its | 1046 // The call to AddBlankTab above did not set the focus to the tab as its |
(...skipping 2409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3456 if (TabHasUnloadListener(contents)) { | 3456 if (TabHasUnloadListener(contents)) { |
3457 // If the page has unload listeners, then we tell the renderer to fire | 3457 // If the page has unload listeners, then we tell the renderer to fire |
3458 // them. Once they have fired, we'll get a message back saying whether | 3458 // them. Once they have fired, we'll get a message back saying whether |
3459 // to proceed closing the page or not, which sends us back to this method | 3459 // to proceed closing the page or not, which sends us back to this method |
3460 // with the HasUnloadListener bit cleared. | 3460 // with the HasUnloadListener bit cleared. |
3461 contents->render_view_host()->FirePageBeforeUnload(false); | 3461 contents->render_view_host()->FirePageBeforeUnload(false); |
3462 return true; | 3462 return true; |
3463 } | 3463 } |
3464 return false; | 3464 return false; |
3465 } | 3465 } |
OLD | NEW |