#include "chrome/browser/profiles/avatar_menu.h"
#include <optional>
#include "base/functional/bind.h"
#include "base/i18n/case_conversion.h"
#include "base/metrics/field_trial.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/avatar_menu_observer.h"
#include "chrome/browser/profiles/profile_list_desktop.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_window.h"
#include "chrome/browser/profiles/profiles_state.h"
#include "chrome/browser/supervised_user/supervised_user_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/profiles/profile_picker.h"
#include "chrome/browser/ui/startup/startup_browser_creator.h"
#include "chrome/common/buildflags.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/grit/generated_resources.h"
#include "components/prefs/pref_service.h"
#include "components/supervised_user/core/browser/supervised_user_service.h"
#include "content/public/browser/browser_thread.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
BrowserThread;
namespace {
bool CanOpenBrowserForProfile(const AvatarMenu::Item& profile_item) { … }
}
AvatarMenu::AvatarMenu(ProfileAttributesStorage* profile_storage,
AvatarMenuObserver* observer,
Browser* browser)
: … { … }
AvatarMenu::~AvatarMenu() { … }
AvatarMenu::Item::Item(size_t menu_index,
const base::FilePath& profile_path,
const gfx::Image& icon)
: … { … }
AvatarMenu::Item::Item(const Item& other) = default;
AvatarMenu::Item::~Item() = default;
void AvatarMenu::SwitchToProfile(size_t index, bool always_create) { … }
void AvatarMenu::AddNewProfile() { … }
void AvatarMenu::EditProfile(size_t index) { … }
void AvatarMenu::RebuildMenu() { … }
size_t AvatarMenu::GetNumberOfItems() const { … }
const AvatarMenu::Item& AvatarMenu::GetItemAt(size_t index) const { … }
size_t AvatarMenu::GetIndexOfItemWithProfilePathForTesting(
const base::FilePath& path) const { … }
std::optional<size_t> AvatarMenu::GetActiveProfileIndex() const { … }
void AvatarMenu::ActiveBrowserChanged(Browser* browser) { … }
bool AvatarMenu::ShouldShowAddNewProfileLink() const { … }
bool AvatarMenu::ShouldShowEditProfileLink() const { … }
void AvatarMenu::OnProfileAdded(const base::FilePath& profile_path) { … }
void AvatarMenu::OnProfileWasRemoved(const base::FilePath& profile_path,
const std::u16string& profile_name) { … }
void AvatarMenu::OnProfileNameChanged(const base::FilePath& profile_path,
const std::u16string& old_profile_name) { … }
void AvatarMenu::OnProfileAuthInfoChanged(const base::FilePath& profile_path) { … }
void AvatarMenu::OnProfileAvatarChanged(const base::FilePath& profile_path) { … }
void AvatarMenu::OnProfileHighResAvatarLoaded(
const base::FilePath& profile_path) { … }
void AvatarMenu::OnProfileSigninRequiredChanged(
const base::FilePath& profile_path) { … }
void AvatarMenu::OnProfileIsOmittedChanged(const base::FilePath& profile_path) { … }
void AvatarMenu::OnCustodianInfoChanged() { … }
void AvatarMenu::Update() { … }