summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser.cc
diff options
context:
space:
mode:
authorviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-09 17:02:50 +0000
committerviettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-09 17:02:50 +0000
commit7dc8c6baea151a7e803b3781f89e81c5e53ee40e (patch)
tree3f4f72ef5eae82b976657a70f188d21e77bf9cad /chrome/browser/browser.cc
parent7717e6e61a7b681d9ed351339c2850ae13b5ccb3 (diff)
downloadchromium_src-7dc8c6baea151a7e803b3781f89e81c5e53ee40e.zip
chromium_src-7dc8c6baea151a7e803b3781f89e81c5e53ee40e.tar.gz
chromium_src-7dc8c6baea151a7e803b3781f89e81c5e53ee40e.tar.bz2
Mac: reform our shutdown routine.
Make shutdown be more like other platforms. Moreover: - Cancelling quit from an onbeforeunload dialog shouldn't mess up the browser. - Having quit cancelled due to a window pop up on the closure of another window shouldn't break the browser. [With this patch, it will result in the browser being in a quirky state in which the closure of the last browser window will cause a quit. But the browser won't be broken.] BUG=34384,37813,37927 TEST=See bugs. Review URL: http://codereview.chromium.org/1520006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44096 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.cc')
-rw-r--r--chrome/browser/browser.cc14
1 files changed, 9 insertions, 5 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 1c510dc..dffd1cd 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -636,14 +636,18 @@ void Browser::OnWindowClosing() {
bool exiting = false;
-#if defined(OS_WIN) || defined(OS_LINUX)
- // We don't want to do this on Mac since closing all windows isn't a sign
- // that the app is shutting down.
- if (BrowserList::size() == 1) {
+#if defined(OS_MACOSX)
+ // On Mac, closing the last window isn't usually a sign that the app is
+ // shutting down.
+ bool should_quit_if_last_browser = browser_shutdown::IsTryingToQuit();
+#else
+ bool should_quit_if_last_browser = true;
+#endif
+
+ if (should_quit_if_last_browser && BrowserList::size() == 1) {
browser_shutdown::OnShutdownStarting(browser_shutdown::WINDOW_CLOSE);
exiting = true;
}
-#endif
// Don't use HasSessionService here, we want to force creation of the
// session service so that user can restore what was open.