Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(385)

Unified Diff: chrome/browser/ui/browser_init.cc

Issue 7497056: Mac Lion: Chrome opens new window on restart when no windows were previously open (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Braces Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/mac/mac_util.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « base/mac/mac_util.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698