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_init.h" | 5 #include "chrome/browser/ui/browser_init.h" |
6 | 6 |
7 #include <algorithm> // For max(). | 7 #include <algorithm> // For max(). |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/environment.h" | 10 #include "base/environment.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 #include "grit/generated_resources.h" | 71 #include "grit/generated_resources.h" |
72 #include "grit/locale_settings.h" | 72 #include "grit/locale_settings.h" |
73 #include "grit/theme_resources.h" | 73 #include "grit/theme_resources.h" |
74 #include "grit/theme_resources_standard.h" | 74 #include "grit/theme_resources_standard.h" |
75 #include "net/base/net_util.h" | 75 #include "net/base/net_util.h" |
76 #include "ui/base/l10n/l10n_util.h" | 76 #include "ui/base/l10n/l10n_util.h" |
77 #include "ui/base/resource/resource_bundle.h" | 77 #include "ui/base/resource/resource_bundle.h" |
78 #include "webkit/glue/webkit_glue.h" | 78 #include "webkit/glue/webkit_glue.h" |
79 | 79 |
80 #if defined(OS_MACOSX) | 80 #if defined(OS_MACOSX) |
81 #include "base/mac/mac_util.h" | |
81 #include "chrome/browser/ui/cocoa/keystone_infobar.h" | 82 #include "chrome/browser/ui/cocoa/keystone_infobar.h" |
82 #endif | 83 #endif |
83 | 84 |
84 #if defined(TOOLKIT_USES_GTK) | 85 #if defined(TOOLKIT_USES_GTK) |
85 #include "chrome/browser/ui/gtk/gtk_util.h" | 86 #include "chrome/browser/ui/gtk/gtk_util.h" |
86 #endif | 87 #endif |
87 | 88 |
88 #if defined(OS_CHROMEOS) | 89 #if defined(OS_CHROMEOS) |
89 #include "chrome/browser/chromeos/cros/cros_library.h" | 90 #include "chrome/browser/chromeos/cros/cros_library.h" |
90 #include "chrome/browser/chromeos/cros/mount_library.h" | 91 #include "chrome/browser/chromeos/cros/mount_library.h" |
(...skipping 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
902 | 903 |
903 if (pref.type == SessionStartupPref::LAST) { | 904 if (pref.type == SessionStartupPref::LAST) { |
904 if (!profile_->DidLastSessionExitCleanly() && | 905 if (!profile_->DidLastSessionExitCleanly() && |
905 !command_line_.HasSwitch(switches::kRestoreLastSession)) { | 906 !command_line_.HasSwitch(switches::kRestoreLastSession)) { |
906 // The last session crashed. It's possible automatically loading the | 907 // The last session crashed. It's possible automatically loading the |
907 // page will trigger another crash, locking the user out of chrome. | 908 // page will trigger another crash, locking the user out of chrome. |
908 // To avoid this, don't restore on startup but instead show the crashed | 909 // To avoid this, don't restore on startup but instead show the crashed |
909 // infobar. | 910 // infobar. |
910 return false; | 911 return false; |
911 } | 912 } |
912 Browser* browser = SessionRestore::RestoreSession( | 913 |
913 profile_, NULL, | 914 uint32 restore_behavior = SessionRestore::SYNCHRONOUS | |
914 (SessionRestore::SYNCHRONOUS | | 915 SessionRestore::ALWAYS_CREATE_TABBED_BROWSER; |
915 SessionRestore::ALWAYS_CREATE_TABBED_BROWSER), urls_to_open); | 916 #if defined(OS_MACOSX) |
917 // On Mac, when restoring a session with no windows, suppress the creation | |
918 // of a new window in the case where the system is launching Chrome via a | |
919 // login item or Lion's resume feature. | |
920 if (base::mac::WasLaunchedAsLoginOrResumeItem()) | |
Mark Mentovai
2011/08/10 15:53:02
Use {braces} around the multi-line job.
dhollowa
2011/08/10 16:16:57
Done.
| |
921 restore_behavior = restore_behavior & | |
922 ~SessionRestore::ALWAYS_CREATE_TABBED_BROWSER; | |
923 #endif | |
924 | |
925 Browser* browser = SessionRestore::RestoreSession(profile_, | |
926 NULL, | |
927 restore_behavior, | |
928 urls_to_open); | |
916 AddInfoBarsIfNecessary(browser); | 929 AddInfoBarsIfNecessary(browser); |
917 return true; | 930 return true; |
918 } | 931 } |
919 | 932 |
920 std::vector<Tab> tabs = PinnedTabCodec::ReadPinnedTabs(profile_); | 933 std::vector<Tab> tabs = PinnedTabCodec::ReadPinnedTabs(profile_); |
921 | 934 |
922 RecordAppLaunches(profile_, urls_to_open, tabs); | 935 RecordAppLaunches(profile_, urls_to_open, tabs); |
923 | 936 |
924 if (!urls_to_open.empty()) { | 937 if (!urls_to_open.empty()) { |
925 // If urls were specified on the command line, use them. | 938 // If urls were specified on the command line, use them. |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1449 return false; | 1462 return false; |
1450 automation->SetExpectedTabCount(expected_tabs); | 1463 automation->SetExpectedTabCount(expected_tabs); |
1451 | 1464 |
1452 AutomationProviderList* list = | 1465 AutomationProviderList* list = |
1453 g_browser_process->InitAutomationProviderList(); | 1466 g_browser_process->InitAutomationProviderList(); |
1454 DCHECK(list); | 1467 DCHECK(list); |
1455 list->AddProvider(automation); | 1468 list->AddProvider(automation); |
1456 | 1469 |
1457 return true; | 1470 return true; |
1458 } | 1471 } |
OLD | NEW |