Index: chrome/browser/ui/browser_init.cc |
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc |
index 9aaa2bbcc6d29ec67f923cc91b8da8330970d417..fefa94f597eb2a5d0fc0168ba6c58ea59e342b5e 100644 |
--- a/chrome/browser/ui/browser_init.cc |
+++ b/chrome/browser/ui/browser_init.cc |
@@ -78,6 +78,7 @@ |
#include "webkit/glue/webkit_glue.h" |
#if defined(OS_MACOSX) |
+#include "base/mac/mac_util.h" |
#include "chrome/browser/ui/cocoa/keystone_infobar.h" |
#endif |
@@ -912,10 +913,23 @@ bool BrowserInit::LaunchWithProfile::ProcessStartupURLs( |
// infobar. |
return false; |
} |
- Browser* browser = SessionRestore::RestoreSession( |
- profile_, NULL, |
- (SessionRestore::SYNCHRONOUS | |
- SessionRestore::ALWAYS_CREATE_TABBED_BROWSER), urls_to_open); |
+ |
+ uint32 restore_behavior = SessionRestore::SYNCHRONOUS | |
+ SessionRestore::ALWAYS_CREATE_TABBED_BROWSER; |
+#if defined(OS_MACOSX) |
+ // On Mac, when restoring a session with no windows, suppress the creation |
+ // of a new window in the case where the system is launching Chrome via a |
+ // login item or Lion's resume feature. |
+ if (base::mac::WasLaunchedAsLoginOrResumeItem()) { |
+ restore_behavior = restore_behavior & |
+ ~SessionRestore::ALWAYS_CREATE_TABBED_BROWSER; |
+ } |
+#endif |
+ |
+ Browser* browser = SessionRestore::RestoreSession(profile_, |
+ NULL, |
+ restore_behavior, |
+ urls_to_open); |
AddInfoBarsIfNecessary(browser); |
return true; |
} |