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

Unified Diff: chrome/browser/app_controller_mac.mm

Issue 340023: Fix window restore behaviour on Mac. (Closed)
Patch Set: Fix namespace naming Created 11 years, 2 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 | « chrome/browser/app_controller_cppsafe_mac.h ('k') | chrome/browser/sessions/session_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/app_controller_mac.mm
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index fcbdb232098bb328224702bd7b2a055bdacb538d..faf678960584b259f746d3f22288963b2e27f051 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -53,6 +53,12 @@
- (BOOL)shouldQuitWithInProgressDownloads;
@end
+// True while AppController is calling Browser::OpenEmptyWindow(). We need a
+// global flag here, analogue to BrowserInit::InProcessStartup() because
+// otherwise the SessionService will try to restore sessions when we make a new
+// window while there are no other active windows.
+static bool g_is_opening_new_window = false;
+
@implementation AppController
// This method is called very early in application startup (ie, before
@@ -489,7 +495,9 @@
switch (tag) {
case IDC_NEW_TAB:
case IDC_NEW_WINDOW:
+ g_is_opening_new_window = true;
Browser::OpenEmptyWindow(defaultProfile);
+ g_is_opening_new_window = false;
break;
case IDC_NEW_INCOGNITO_WINDOW:
Browser::OpenEmptyWindow(defaultProfile->GetOffTheRecordProfile());
@@ -527,7 +535,9 @@
return YES;
// Otherwise open a new window.
+ g_is_opening_new_window = true;
Browser::OpenEmptyWindow([self defaultProfile]);
+ g_is_opening_new_window = false;
// We've handled the reopen event, so return NO to tell AppKit not
// to do anything.
@@ -729,3 +739,11 @@ void ShowOptionsWindow(OptionsPage page,
Profile* profile) {
NOTIMPLEMENTED();
}
+
+namespace app_controller_mac {
+
+bool IsOpeningNewWindow() {
+ return g_is_opening_new_window;
+}
+
+} // namespace app_controller_mac
« no previous file with comments | « chrome/browser/app_controller_cppsafe_mac.h ('k') | chrome/browser/sessions/session_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698