#include "chrome/browser/lifetime/application_lifetime_desktop.h"
#include <optional>
#include "base/callback_list.h"
#include "base/functional/bind.h"
#include "base/no_destructor.h"
#include "base/process/process.h"
#include "base/threading/hang_watcher.h"
#include "base/time/time.h"
#include "base/types/strong_alias.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_process_platform_part.h"
#include "chrome/browser/download/download_core_service.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/lifetime/browser_close_manager.h"
#include "chrome/browser/lifetime/browser_shutdown.h"
#include "chrome/browser/lifetime/termination_notification.h"
#include "chrome/browser/metrics/shutdown_watcher_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/sessions/exit_type_service.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/common/buildflags.h"
#include "chrome/common/pref_names.h"
#include "components/keep_alive_registry/keep_alive_registry.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ash/boot_times_recorder/boot_times_recorder.h"
#include "chrome/browser/lifetime/application_lifetime_chromeos.h"
#else
#include "chrome/browser/ui/profiles/profile_picker.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chromeos/crosapi/mojom/browser_service.mojom.h"
#include "chromeos/lacros/lacros_service.h"
#endif
#if BUILDFLAG(IS_WIN)
#include "base/win/win_util.h"
#endif
#if BUILDFLAG(ENABLE_SESSION_SERVICE)
#include "chrome/browser/sessions/session_data_service.h"
#include "chrome/browser/sessions/session_data_service_factory.h"
#endif
namespace chrome {
namespace {
base::RepeatingCallbackList<void(bool)>& GetClosingAllBrowsersCallbackList() { … }
IgnoreUnloadHandlers;
void AttemptRestartInternal(IgnoreUnloadHandlers ignore_unload_handlers) { … }
void ShutdownIfNoBrowsers() { … }
}
void CloseAllBrowsersAndQuit() { … }
void CloseAllBrowsers() { … }
void AttemptRestart() { … }
#if !BUILDFLAG(IS_CHROMEOS_ASH)
void RelaunchIgnoreUnloadHandlers() { … }
#endif
void SessionEnding() { … }
void ShutdownIfNeeded() { … }
void OnAppExiting() { … }
void OnClosingAllBrowsers(bool closing) { … }
base::CallbackListSubscription AddClosingAllBrowsersCallback(
base::RepeatingCallback<void(bool)> closing_all_browsers_callback) { … }
void MarkAsCleanShutdown() { … }
bool AreAllBrowsersCloseable() { … }
}