#include "chrome/browser/profiles/profile_window.h"
#include <stddef.h>
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/location.h"
#include "base/metrics/user_metrics.h"
#include "base/strings/escape.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/browser/about_flags.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_attributes_entry.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/signin/account_reconcilor_factory.h"
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/signin/signin_ui_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "components/flags_ui/pref_service_flags_storage.h"
#include "components/prefs/pref_service.h"
#include "components/signin/public/base/signin_pref_names.h"
#include "components/signin/public/identity_manager/account_info.h"
#include "components/signin/public/identity_manager/identity_manager.h"
#include "content/public/browser/browser_thread.h"
#include "extensions/buildflags/buildflags.h"
#include "third_party/abseil-cpp/absl/cleanup/cleanup.h"
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/extension_service.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_registry_factory.h"
#include "extensions/browser/extension_system.h"
#endif
#if !BUILDFLAG(IS_ANDROID)
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_list_observer.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/startup/startup_browser_creator.h"
#endif
#if !BUILDFLAG(IS_CHROMEOS_ASH)
#include "chrome/browser/ui/profiles/profile_picker.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_LACROS)
#include "chrome/browser/profiles/profiles_state.h"
#endif
UserMetricsAction;
BrowserThread;
namespace {
#if BUILDFLAG(ENABLE_EXTENSIONS)
void UnblockExtensions(Profile* profile) { … }
#endif
void ProfileLoadedCallback(base::OnceCallback<void(Profile*)> callback,
Profile* profile) { … }
}
namespace profiles {
void FindOrCreateNewWindowForProfile(
Profile* profile,
chrome::startup::IsProcessStartup process_startup,
chrome::startup::IsFirstRun is_first_run,
bool always_create) { … }
void OpenBrowserWindowForProfile(base::OnceCallback<void(Browser*)> callback,
bool always_create,
bool is_new_profile,
bool unblock_extensions,
Profile* profile) { … }
#if !BUILDFLAG(IS_ANDROID)
void LoadProfileAsync(const base::FilePath& path,
base::OnceCallback<void(Profile*)> callback) { … }
void SwitchToProfile(const base::FilePath& path,
bool always_create,
base::OnceCallback<void(Browser*)> callback) { … }
void SwitchToGuestProfile(base::OnceCallback<void(Browser*)> callback) { … }
#endif
bool HasProfileSwitchTargets(Profile* profile) { … }
void CloseProfileWindows(Profile* profile) { … }
BrowserAddedForProfileObserver::BrowserAddedForProfileObserver(
Profile* profile,
base::OnceCallback<void(Browser*)> callback)
: … { … }
BrowserAddedForProfileObserver::~BrowserAddedForProfileObserver() { … }
void BrowserAddedForProfileObserver::OnBrowserAdded(Browser* browser) { … }
void BrowserAddedForProfileObserver::OnBrowserRemoved(Browser* browser) { … }
void BrowserAddedForProfileObserver::NotifyBrowserCreatedAnDie() { … }
}