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

Unified Diff: chrome/browser/lifetime/application_lifetime.cc

Issue 25603004: Leave apps running on Windows and Linux when quitting Chrome from the wrench menu. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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
Index: chrome/browser/lifetime/application_lifetime.cc
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc
index 0693c58f08a7e48398ecbaeee2248f5ba129c73d..9aaa818ef19cb77bfd058d080c4359b6a4c6963a 100644
--- a/chrome/browser/lifetime/application_lifetime.cc
+++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -86,20 +86,36 @@ void MarkAsCleanShutdown() {
it->profile()->SetExitType(Profile::EXIT_NORMAL);
}
-void AttemptExitInternal() {
+void AttemptExitInternal(bool try_to_quit_application) {
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST,
content::NotificationService::AllSources(),
content::NotificationService::NoDetails());
+ // On Mac, the platform-specific part handles setting this.
+#if !defined(OS_MACOSX)
sky 2013/10/22 15:41:18 Is there a reason you set trying to quit after sen
Sam McNally 2013/10/22 22:58:29 Done.
+ if (try_to_quit_application) {
sky 2013/10/22 15:41:18 nit: no {}
Sam McNally 2013/10/22 22:58:29 Done.
+ browser_shutdown::SetTryingToQuit(true);
+ }
+#endif
+
g_browser_process->platform_part()->AttemptExit();
}
+void CloseAllBrowsersAndQuit() {
+ browser_shutdown::SetTryingToQuit(true);
+ CloseAllBrowsers();
+}
+
void CloseAllBrowsers() {
- // If there are no browsers, send the APP_TERMINATING action here. Otherwise,
- // it will be sent by RemoveBrowser() when the last browser has closed.
+ // If there are no browsers and closing the last browser would quit the
+ // application, send the APP_TERMINATING action here. Otherwise, it will be
+ // sent by RemoveBrowser() when the last browser has closed.
if (browser_shutdown::ShuttingDownWithoutClosingBrowsers() ||
- chrome::GetTotalBrowserCount() == 0) {
+ (chrome::GetTotalBrowserCount() == 0 &&
+ (browser_shutdown::IsTryingToQuit() || !chrome::WillKeepAlive() ||
+ CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableBatchedShutdown)))) {
// Tell everyone that we are shutting down.
browser_shutdown::SetTryingToQuit(true);
@@ -153,7 +169,7 @@ void AttemptUserExit() {
// request.
PrefService* pref_service = g_browser_process->local_state();
pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, false);
- AttemptExitInternal();
+ AttemptExitInternal(false);
#endif
}
@@ -212,7 +228,7 @@ void AttemptExit() {
if (AreAllBrowsersCloseable())
MarkAsCleanShutdown();
#endif
- AttemptExitInternal();
+ AttemptExitInternal(true);
}
#if defined(OS_CHROMEOS)
@@ -227,7 +243,7 @@ void ExitCleanly() {
// screen locker.
if (!AreAllBrowsersCloseable())
browser_shutdown::OnShutdownStarting(browser_shutdown::END_SESSION);
- AttemptExitInternal();
+ AttemptExitInternal(true);
}
#endif

Powered by Google App Engine
This is Rietveld 408576698