Index: chrome/browser/ui/browser_init.cc |
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc |
index 0f672f366321829d09984617a77ee05a2e2947d5..56ff5c97c9d6854c752dec5069e4697c35a70575 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 |
@@ -909,10 +910,22 @@ 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()) |
Mark Mentovai
2011/08/10 15:53:02
Use {braces} around the multi-line job.
dhollowa
2011/08/10 16:16:57
Done.
|
+ 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; |
} |