summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sessions
diff options
context:
space:
mode:
authorerg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-29 17:05:23 +0000
committererg@chromium.org <erg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-29 17:05:23 +0000
commit216e904053b111d31cf5fad355f2bb57743182cc (patch)
treefb3cc29c35622a2b75b435fd61eb6d7352ed4dd0 /chrome/browser/sessions
parent5c558bc54d375335982ebcd947840a9a1f4eab40 (diff)
downloadchromium_src-216e904053b111d31cf5fad355f2bb57743182cc.zip
chromium_src-216e904053b111d31cf5fad355f2bb57743182cc.tar.gz
chromium_src-216e904053b111d31cf5fad355f2bb57743182cc.tar.bz2
Fix window restore behaviour on Mac.
On the mac, there can be no windows, but the application is sitll open. This confused "Restore the pages that were open last" so that it would restore when opening a new window. BUG=13341 TEST=Open chromium. Set On Startup to "Restore the pages that were open last". Open a few tabs. Close the window (but not chromium). Click the dock icon. The tabs shouldn't be restored. But if you quit chrome and start again, things should reopen. Review URL: http://codereview.chromium.org/340023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30463 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sessions')
-rw-r--r--chrome/browser/sessions/session_service.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc
index 31c2966..4682ca3 100644
--- a/chrome/browser/sessions/session_service.cc
+++ b/chrome/browser/sessions/session_service.cc
@@ -29,6 +29,10 @@
#include "chrome/common/notification_details.h"
#include "chrome/common/notification_service.h"
+#if defined(OS_MACOSX)
+#include "chrome/browser/app_controller_cppsafe_mac.h"
+#endif
+
using base::Time;
// Identifier for commands written to file.
@@ -409,7 +413,14 @@ void SessionService::Observe(NotificationType type,
return;
}
- if (!has_open_trackable_browsers_ && !BrowserInit::InProcessStartup()) {
+ if (!has_open_trackable_browsers_ && !BrowserInit::InProcessStartup()
+#if defined(OS_MACOSX)
+ // OSX has a fairly different idea of application lifetime than the
+ // other platforms. We need to check that we aren't opening a window
+ // from the dock or the menubar.
+ && !app_controller_mac::IsOpeningNewWindow()
+#endif
+ ) {
// We're going from no tabbed browsers to a tabbed browser (and not in
// process startup), restore the last session.
if (move_on_new_browser_) {