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

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: 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 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;
}
« 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