| Index: chrome/browser/browser_shutdown.cc
|
| diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc
|
| index ab8f9d7561797948661f840a633e867733a84666..c49479297643f4d0130cc046a7d6647862043701 100644
|
| --- a/chrome/browser/browser_shutdown.cc
|
| +++ b/chrome/browser/browser_shutdown.cc
|
| @@ -47,6 +47,10 @@
|
| #include "chrome/browser/first_run/upgrade_util.h"
|
| #endif
|
|
|
| +#if BUILDFLAG(ENABLE_BACKGROUND)
|
| +#include "chrome/browser/background/background_mode_manager.h"
|
| +#endif
|
| +
|
| #if defined(ENABLE_RLZ)
|
| #include "components/rlz/rlz_tracker.h"
|
| #endif
|
| @@ -194,7 +198,7 @@ bool ShutdownPreThreadsStop() {
|
| return restart_last_session;
|
| }
|
|
|
| -void ShutdownPostThreadsStop(bool restart_last_session) {
|
| +void ShutdownPostThreadsStop(int shutdown_flags) {
|
| delete g_browser_process;
|
| g_browser_process = NULL;
|
|
|
| @@ -214,7 +218,7 @@ void ShutdownPostThreadsStop(bool restart_last_session) {
|
| }
|
| #endif
|
|
|
| - if (restart_last_session) {
|
| + if (shutdown_flags & RESTART_LAST_SESSION) {
|
| #if !defined(OS_CHROMEOS)
|
| // Make sure to relaunch the browser with the original command line plus
|
| // the Restore Last Session flag. Note that Chrome can be launched (ie.
|
| @@ -239,6 +243,8 @@ void ShutdownPostThreadsStop(bool restart_last_session) {
|
| else
|
| new_cl->AppendSwitch(it.first);
|
| }
|
| + if (shutdown_flags & RESTART_IN_BACKGROUND)
|
| + new_cl->AppendSwitch(switches::kNoStartupWindow);
|
|
|
| #if defined(OS_POSIX) || defined(OS_WIN)
|
| upgrade_util::RelaunchChromeBrowser(*new_cl.get());
|
| @@ -329,6 +335,24 @@ void ReadLastShutdownInfo() {
|
|
|
| void SetTryingToQuit(bool quitting) {
|
| g_trying_to_quit = quitting;
|
| +
|
| + if (quitting)
|
| + return;
|
| +
|
| + // Reset the restart-related preferences. They get set unconditionally through
|
| + // calls such as chrome::AttemptRestart(), and need to be reset if the restart
|
| + // attempt is cancelled.
|
| + PrefService* pref_service = g_browser_process->local_state();
|
| + if (pref_service) {
|
| +#if !defined(OS_ANDROID)
|
| + pref_service->ClearPref(prefs::kWasRestarted);
|
| +#endif // !defined(OS_ANDROID)
|
| + pref_service->ClearPref(prefs::kRestartLastSessionOnShutdown);
|
| + }
|
| +
|
| +#if BUILDFLAG(ENABLE_BACKGROUND)
|
| + BackgroundModeManager::set_should_restart_in_background(false);
|
| +#endif // BUILDFLAG(ENABLE_BACKGROUND)
|
| }
|
|
|
| bool IsTryingToQuit() {
|
|
|