#include "chrome/browser/ui/views/profiles/avatar_toolbar_button.h"
#include <vector>
#include "base/check.h"
#include "base/compiler_specific.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/notreached.h"
#include "base/observer_list.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/time.h"
#include "build/chromeos_buildflags.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/app/vector_icons/vector_icons.h"
#include "chrome/browser/profiles/avatar_menu.h"
#include "chrome/browser/profiles/profile_avatar_icon_util.h"
#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/themes/theme_properties.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_element_identifiers.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/color/chrome_color_id.h"
#include "chrome/browser/ui/layout_constants.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/profiles/avatar_toolbar_button_delegate.h"
#include "chrome/browser/ui/views/profiles/profile_menu_coordinator.h"
#include "chrome/browser/ui/views/toolbar/toolbar_button.h"
#include "chrome/browser/ui/views/toolbar/toolbar_ink_drop_util.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "chrome/grit/branded_strings.h"
#include "chrome/grit/generated_resources.h"
#include "components/feature_engagement/public/feature_constants.h"
#include "components/feature_engagement/public/tracker.h"
#include "components/password_manager/content/common/web_ui_constants.h"
#include "components/signin/public/base/signin_switches.h"
#include "components/signin/public/identity_manager/tribool.h"
#include "components/user_education/common/user_education_class_properties.h"
#include "content/public/common/url_utils.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/metadata/metadata_impl_macros.h"
#include "ui/base/models/image_model_utils.h"
#include "ui/base/models/menu_model.h"
#include "ui/base/theme_provider.h"
#include "ui/base/ui_base_features.h"
#include "ui/color/color_provider.h"
#include "ui/compositor/layer.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/controls/button/button_controller.h"
#include "ui/views/controls/button/label_button_border.h"
#include "ui/views/view_class_properties.h"
namespace {
constexpr int kChromeRefreshImageLabelPadding = …;
constexpr int kAvatarIconEnlargement = …;
}
base::TimeDelta AvatarToolbarButton::g_iph_min_delay_after_creation = …;
AvatarToolbarButton::AvatarToolbarButton(BrowserView* browser_view)
: … { … }
AvatarToolbarButton::~AvatarToolbarButton() = default;
void AvatarToolbarButton::UpdateIcon() { … }
void AvatarToolbarButton::AddedToWidget() { … }
void AvatarToolbarButton::Layout(PassKey) { … }
void AvatarToolbarButton::UpdateText() { … }
void AvatarToolbarButton::UpdateAccessibilityLabel() { … }
std::optional<SkColor> AvatarToolbarButton::GetHighlightTextColor() const { … }
std::optional<SkColor> AvatarToolbarButton::GetHighlightBorderColor() const { … }
void AvatarToolbarButton::UpdateInkdrop() { … }
bool AvatarToolbarButton::ShouldPaintBorder() const { … }
bool AvatarToolbarButton::ShouldBlendHighlightColor() const { … }
base::ScopedClosureRunner AvatarToolbarButton::ShowExplicitText(
const std::u16string& text,
std::optional<std::u16string> accessibility_label) { … }
void AvatarToolbarButton::ResetButtonAction() { … }
base::ScopedClosureRunner AvatarToolbarButton::SetExplicitButtonAction(
base::RepeatingClosure explicit_closure) { … }
bool AvatarToolbarButton::HasExplicitButtonAction() const { … }
void AvatarToolbarButton::SetButtonActionDisabled(bool disabled) { … }
bool AvatarToolbarButton::IsButtonActionDisabled() const { … }
void AvatarToolbarButton::MaybeShowProfileSwitchIPH() { … }
void AvatarToolbarButton::MaybeShowSupervisedUserSignInIPH(
const AccountInfo& account_info) { … }
void AvatarToolbarButton::MaybeShowExplicitBrowserSigninPreferenceRememberedIPH(
const AccountInfo& account_info) { … }
void AvatarToolbarButton::MaybeShowWebSignoutIPH(const std::string& gaia_id) { … }
void AvatarToolbarButton::OnMouseExited(const ui::MouseEvent& event) { … }
void AvatarToolbarButton::OnBlur() { … }
void AvatarToolbarButton::OnThemeChanged() { … }
void AvatarToolbarButton::SetIPHMinDelayAfterCreationForTesting(
base::TimeDelta delay) { … }
void AvatarToolbarButton::ButtonPressed(bool is_source_accelerator) { … }
void AvatarToolbarButton::AfterPropertyChange(const void* key,
int64_t old_value) { … }
SkColor AvatarToolbarButton::GetForegroundColor(ButtonState state) const { … }
bool AvatarToolbarButton::IsLabelPresentAndVisible() const { … }
void AvatarToolbarButton::UpdateLayoutInsets() { … }
int AvatarToolbarButton::GetIconSize() const { … }
void AvatarToolbarButton::AddObserver(Observer* observer) { … }
void AvatarToolbarButton::RemoveObserver(Observer* observer) { … }
void AvatarToolbarButton::PaintButtonContents(gfx::Canvas* canvas) { … }
base::AutoReset<std::optional<base::TimeDelta>>
AvatarToolbarButton::CreateScopedInfiniteDelayOverrideForTesting(
AvatarDelayType delay_type) { … }
void AvatarToolbarButton::TriggerTimeoutForTesting(AvatarDelayType delay_type) { … }
base::AutoReset<std::optional<base::TimeDelta>> AvatarToolbarButton::
CreateScopedZeroDelayOverrideSigninPendingTextForTesting() { … }
BEGIN_METADATA(…)