#include "chrome/browser/ui/browser_list.h"
#include "base/auto_reset.h"
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/user_metrics.h"
#include "base/observer_list.h"
#include "base/ranges/algorithm.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/buildflags.h"
#include "chrome/browser/lifetime/application_lifetime_desktop.h"
#include "chrome/browser/lifetime/browser_shutdown.h"
#include "chrome/browser/lifetime/termination_notification.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/app_session_service_factory.h"
#include "chrome/browser/sessions/session_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list_observer.h"
#include "chrome/browser/ui/browser_window.h"
UserMetricsAction;
WebContents;
namespace {
BrowserList::BrowserWeakVector GetBrowsersToClose(Profile* profile) { … }
BrowserList::BrowserWeakVector GetIncognitoBrowsersToClose(Profile* profile) { … }
}
base::LazyInstance<base::ObserverList<BrowserListObserver>,
BrowserList::ObserverListTraits>
BrowserList::observers_ = …;
BrowserList* BrowserList::instance_ = …;
Browser* BrowserList::GetLastActive() const { … }
BrowserList* BrowserList::GetInstance() { … }
void BrowserList::AddBrowser(Browser* browser) { … }
void BrowserList::RemoveBrowser(Browser* browser) { … }
void BrowserList::AddBrowserToActiveList(Browser* browser) { … }
void BrowserList::AddObserver(BrowserListObserver* observer) { … }
void BrowserList::RemoveObserver(BrowserListObserver* observer) { … }
void BrowserList::CloseAllBrowsersWithProfile(Profile* profile) { … }
void BrowserList::CloseAllBrowsersWithProfile(
Profile* profile,
const CloseCallback& on_close_success,
const CloseCallback& on_close_aborted,
bool skip_beforeunload) { … }
void BrowserList::CloseAllBrowsersWithIncognitoProfile(
Profile* profile,
const CloseCallback& on_close_success,
const CloseCallback& on_close_aborted,
bool skip_beforeunload) { … }
void BrowserList::TryToCloseBrowserList(
const BrowserWeakVector& browsers_to_close,
const CloseCallback& on_close_success,
const CloseCallback& on_close_aborted,
const base::FilePath& profile_path,
const bool skip_beforeunload) { … }
void BrowserList::PostTryToCloseBrowserWindow(
const BrowserWeakVector& browsers_to_close,
const CloseCallback& on_close_success,
const CloseCallback& on_close_aborted,
const base::FilePath& profile_path,
const bool skip_beforeunload,
bool tab_close_confirmed) { … }
void BrowserList::MoveBrowsersInWorkspaceToFront(
const std::string& new_workspace) { … }
void BrowserList::SetLastActive(Browser* browser) { … }
void BrowserList::NotifyBrowserNoLongerActive(Browser* browser) { … }
void BrowserList::NotifyBrowserCloseCancelled(Browser* browser,
BrowserClosingStatus reason) { … }
void BrowserList::NotifyBrowserCloseStarted(Browser* browser) { … }
bool BrowserList::IsOffTheRecordBrowserActive() { … }
int BrowserList::GetOffTheRecordBrowsersActiveForProfile(Profile* profile) { … }
size_t BrowserList::GetIncognitoBrowserCount() { … }
size_t BrowserList::GetGuestBrowserCount() { … }
bool BrowserList::IsOffTheRecordBrowserInUse(Profile* profile) { … }
BrowserList::BrowserList() { … }
BrowserList::~BrowserList() { … }
void BrowserList::RemoveBrowserFrom(Browser* browser,
BrowserVector* browser_list) { … }