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

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
« no previous file with comments | « chrome/browser/lifetime/application_lifetime.h ('k') | chrome/browser/lifetime/browser_close_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/lifetime/application_lifetime.cc
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc
index da12a425f796072e5f1a9eba8ec56f6bf57b4f6e..a7a7df6c7e61f209df984a077488329e10d85664 100644
--- a/chrome/browser/lifetime/application_lifetime.cc
+++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -87,7 +87,13 @@ void MarkAsCleanShutdown() {
it->profile()->SetExitType(Profile::EXIT_NORMAL);
}
-void AttemptExitInternal() {
+void AttemptExitInternal(bool try_to_quit_application) {
+ // On Mac, the platform-specific part handles setting this.
+#if !defined(OS_MACOSX)
+ if (try_to_quit_application)
+ browser_shutdown::SetTryingToQuit(true);
+#endif
+
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_CLOSE_ALL_BROWSERS_REQUEST,
content::NotificationService::AllSources(),
@@ -96,11 +102,20 @@ void AttemptExitInternal() {
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);
@@ -154,7 +169,7 @@ void AttemptUserExit() {
// request.
PrefService* pref_service = g_browser_process->local_state();
pref_service->SetBoolean(prefs::kRestartLastSessionOnShutdown, false);
- AttemptExitInternal();
+ AttemptExitInternal(false);
#endif
}
@@ -213,7 +228,7 @@ void AttemptExit() {
if (AreAllBrowsersCloseable())
MarkAsCleanShutdown();
#endif
- AttemptExitInternal();
+ AttemptExitInternal(true);
}
#if defined(OS_CHROMEOS)
@@ -228,7 +243,7 @@ void ExitCleanly() {
// screen locker.
if (!AreAllBrowsersCloseable())
browser_shutdown::OnShutdownStarting(browser_shutdown::END_SESSION);
- AttemptExitInternal();
+ AttemptExitInternal(true);
}
#endif
« no previous file with comments | « chrome/browser/lifetime/application_lifetime.h ('k') | chrome/browser/lifetime/browser_close_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698