0

Prefer the use of the newer 2-param METADATA_HEADER macro.

Bug: 1485768
Change-Id: Idcf672af0e656a2af02164090c010db6950b8446
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5272805
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Reviewed-by: Toni Barzic <tbarzic@chromium.org>
Reviewed-by: James Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1258110}
This commit is contained in:
Allen Bauer
2024-02-08 20:09:39 +00:00
committed by Chromium LUCI CQ
parent 679967504a
commit 9368f04a4e
63 changed files with 158 additions and 133 deletions
ash
assistant
components
arc
hud_display
ime
login
picker
scalable_iph
style
system
chromeos/ui/frame

@@ -50,9 +50,9 @@ std::u16string GetAction(int consent_status) {
// AssistantOptInContainer ----------------------------------------------------- // AssistantOptInContainer -----------------------------------------------------
class AssistantOptInContainer : public views::Button { class AssistantOptInContainer : public views::Button {
public: METADATA_HEADER(AssistantOptInContainer, views::Button)
METADATA_HEADER(AssistantOptInContainer);
public:
explicit AssistantOptInContainer(views::Button::PressedCallback callback) explicit AssistantOptInContainer(views::Button::PressedCallback callback)
: views::Button(std::move(callback)) { : views::Button(std::move(callback)) {
constexpr float kHighlightOpacity = 0.06f; constexpr float kHighlightOpacity = 0.06f;
@@ -89,7 +89,7 @@ class AssistantOptInContainer : public views::Button {
} }
}; };
BEGIN_METADATA(AssistantOptInContainer, views::Button) BEGIN_METADATA(AssistantOptInContainer)
END_METADATA END_METADATA
} // namespace } // namespace

@@ -47,9 +47,9 @@ constexpr int kScrollIndicatorHeightDip = 1;
// thickness to 0 with ScrollView::SetCustomOverflowIndicator. This view is not // thickness to 0 with ScrollView::SetCustomOverflowIndicator. This view is not
// visible. // visible.
class ObservableOverflowIndicator : public views::View { class ObservableOverflowIndicator : public views::View {
public: METADATA_HEADER(ObservableOverflowIndicator, views::View)
METADATA_HEADER(ObservableOverflowIndicator);
public:
explicit ObservableOverflowIndicator( explicit ObservableOverflowIndicator(
UiElementContainerView* ui_element_container_view) UiElementContainerView* ui_element_container_view)
: ui_element_container_view_(ui_element_container_view) {} : ui_element_container_view_(ui_element_container_view) {}
@@ -67,7 +67,7 @@ class ObservableOverflowIndicator : public views::View {
raw_ptr<UiElementContainerView> ui_element_container_view_ = nullptr; raw_ptr<UiElementContainerView> ui_element_container_view_ = nullptr;
}; };
BEGIN_METADATA(ObservableOverflowIndicator, views::View) BEGIN_METADATA(ObservableOverflowIndicator)
END_METADATA END_METADATA
// This is views::View. We define InvisibleOverflowIndicator as we can add // This is views::View. We define InvisibleOverflowIndicator as we can add
@@ -75,11 +75,10 @@ END_METADATA
// ScrollView::SetCustomOverflowIndicator. The background of this view is NOT // ScrollView::SetCustomOverflowIndicator. The background of this view is NOT
// transparent, i.e. it becomes visible if you set thickness larger than 0. // transparent, i.e. it becomes visible if you set thickness larger than 0.
class InvisibleOverflowIndicator : public views::View { class InvisibleOverflowIndicator : public views::View {
public: METADATA_HEADER(InvisibleOverflowIndicator, views::View)
METADATA_HEADER(InvisibleOverflowIndicator);
}; };
BEGIN_METADATA(InvisibleOverflowIndicator, views::View) BEGIN_METADATA(InvisibleOverflowIndicator)
END_METADATA END_METADATA
} // namespace } // namespace

@@ -48,8 +48,10 @@ namespace {
class RoundedCornerBubbleDialogDelegateView class RoundedCornerBubbleDialogDelegateView
: public views::BubbleDialogDelegateView { : public views::BubbleDialogDelegateView {
METADATA_HEADER(RoundedCornerBubbleDialogDelegateView,
views::BubbleDialogDelegateView)
public: public:
METADATA_HEADER(RoundedCornerBubbleDialogDelegateView);
explicit RoundedCornerBubbleDialogDelegateView(int corner_radius) explicit RoundedCornerBubbleDialogDelegateView(int corner_radius)
: corner_radius_(corner_radius) {} : corner_radius_(corner_radius) {}
@@ -70,8 +72,7 @@ class RoundedCornerBubbleDialogDelegateView
this}; this};
}; };
BEGIN_METADATA(RoundedCornerBubbleDialogDelegateView, BEGIN_METADATA(RoundedCornerBubbleDialogDelegateView)
views::BubbleDialogDelegateView)
END_METADATA END_METADATA
} // namespace } // namespace

@@ -70,9 +70,9 @@ class BottomLeftOuterBackground : public views::Background {
// ImageButton with underline // ImageButton with underline
class SettingsButton : public views::ImageButton { class SettingsButton : public views::ImageButton {
public: METADATA_HEADER(SettingsButton, views::ImageButton)
METADATA_HEADER(SettingsButton);
public:
explicit SettingsButton(views::Button::PressedCallback callback) explicit SettingsButton(views::Button::PressedCallback callback)
: views::ImageButton(std::move(callback)) { : views::ImageButton(std::move(callback)) {
SetImageModel( SetImageModel(
@@ -109,7 +109,7 @@ class SettingsButton : public views::ImageButton {
} }
}; };
BEGIN_METADATA(SettingsButton, views::ImageButton) BEGIN_METADATA(SettingsButton)
END_METADATA END_METADATA
// Basically FillLayout that matches host size to the given data view. // Basically FillLayout that matches host size to the given data view.

@@ -28,9 +28,9 @@ const int kMinSize = 31;
const int kShowingDuration = 500; const int kShowingDuration = 500;
class ModeIndicatorFrameView : public views::BubbleFrameView { class ModeIndicatorFrameView : public views::BubbleFrameView {
public: METADATA_HEADER(ModeIndicatorFrameView, views::BubbleFrameView)
METADATA_HEADER(ModeIndicatorFrameView);
public:
explicit ModeIndicatorFrameView() explicit ModeIndicatorFrameView()
: views::BubbleFrameView(gfx::Insets(), gfx::Insets()) {} : views::BubbleFrameView(gfx::Insets(), gfx::Insets()) {}
ModeIndicatorFrameView(const ModeIndicatorFrameView&) = delete; ModeIndicatorFrameView(const ModeIndicatorFrameView&) = delete;
@@ -46,7 +46,7 @@ class ModeIndicatorFrameView : public views::BubbleFrameView {
} }
}; };
BEGIN_METADATA(ModeIndicatorFrameView, views::BubbleFrameView) BEGIN_METADATA(ModeIndicatorFrameView)
END_METADATA END_METADATA
} // namespace } // namespace
@@ -109,7 +109,7 @@ ImeModeIndicatorView::CreateNonClientFrameView(views::Widget* widget) {
return frame; return frame;
} }
BEGIN_METADATA(ImeModeIndicatorView, views::BubbleDialogDelegateView) BEGIN_METADATA(ImeModeIndicatorView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -24,9 +24,9 @@ namespace ash {
// A small bubble that shows the short name of the current IME (e.g. "DV" for // A small bubble that shows the short name of the current IME (e.g. "DV" for
// Dvorak) after switching IMEs with an accelerator (e.g. Ctrl-Space). // Dvorak) after switching IMEs with an accelerator (e.g. Ctrl-Space).
class ASH_EXPORT ImeModeIndicatorView : public views::BubbleDialogDelegateView { class ASH_EXPORT ImeModeIndicatorView : public views::BubbleDialogDelegateView {
public: METADATA_HEADER(ImeModeIndicatorView, views::BubbleDialogDelegateView)
METADATA_HEADER(ImeModeIndicatorView);
public:
// The cursor bounds is in the universal screen coordinates in DIP. // The cursor bounds is in the universal screen coordinates in DIP.
ImeModeIndicatorView(const gfx::Rect& cursor_bounds, ImeModeIndicatorView(const gfx::Rect& cursor_bounds,
const std::u16string& label); const std::u16string& label);

@@ -200,7 +200,7 @@ void ArrowButtonView::SetBackgroundColorId(ui::ColorId color_id) {
color_id, GetPreferredSize().width() / 2, 2 * kBorderForFocusRingDp)); color_id, GetPreferredSize().width() / 2, 2 * kBorderForFocusRingDp));
} }
BEGIN_METADATA(ArrowButtonView, LoginButton) BEGIN_METADATA(ArrowButtonView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -24,9 +24,9 @@ namespace ash {
// This will be used by LoginPublicAccountUserView and expanded public account // This will be used by LoginPublicAccountUserView and expanded public account
// view. // view.
class ASH_EXPORT ArrowButtonView : public LoginButton { class ASH_EXPORT ArrowButtonView : public LoginButton {
public: METADATA_HEADER(ArrowButtonView, LoginButton)
METADATA_HEADER(ArrowButtonView);
public:
ArrowButtonView(PressedCallback callback, int size); ArrowButtonView(PressedCallback callback, int size);
ArrowButtonView(const ArrowButtonView&) = delete; ArrowButtonView(const ArrowButtonView&) = delete;
ArrowButtonView& operator=(const ArrowButtonView&) = delete; ArrowButtonView& operator=(const ArrowButtonView&) = delete;

@@ -2329,7 +2329,7 @@ void LockContentsView::RecordAndResetPasswordAttempts(
unlock_attempt_by_user_[account_id] = 0; unlock_attempt_by_user_[account_id] = 0;
} }
BEGIN_METADATA(LockContentsView, NonAccessibleView) BEGIN_METADATA(LockContentsView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -91,8 +91,9 @@ class ASH_EXPORT LockContentsView
public chromeos::PowerManagerClient::Observer, public chromeos::PowerManagerClient::Observer,
public EnterpriseDomainObserver, public EnterpriseDomainObserver,
public views::FocusChangeListener { public views::FocusChangeListener {
METADATA_HEADER(LockContentsView, NonAccessibleView)
public: public:
METADATA_HEADER(LockContentsView);
friend class LockContentsViewTestApi; friend class LockContentsViewTestApi;
enum class DisplayStyle { enum class DisplayStyle {

@@ -888,7 +888,7 @@ void LockScreenMediaControlsView::RunResetControlsAnimation() {
contents_view_->layer()->SetOpacity(1); contents_view_->layer()->SetOpacity(1);
} }
BEGIN_METADATA(LockScreenMediaControlsView, views::View) BEGIN_METADATA(LockScreenMediaControlsView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -44,9 +44,9 @@ class ASH_EXPORT LockScreenMediaControlsView
public media_session::mojom::MediaControllerImageObserver, public media_session::mojom::MediaControllerImageObserver,
public base::PowerSuspendObserver, public base::PowerSuspendObserver,
public ui::ImplicitAnimationObserver { public ui::ImplicitAnimationObserver {
public: METADATA_HEADER(LockScreenMediaControlsView, views::View)
METADATA_HEADER(LockScreenMediaControlsView);
public:
using MediaControlsEnabled = base::RepeatingCallback<bool()>; using MediaControlsEnabled = base::RepeatingCallback<bool()>;
// The reason why the media controls were hidden. This is recorded in // The reason why the media controls were hidden. This is recorded in

@@ -65,7 +65,7 @@ void LoginErrorBubble::GetAccessibleNodeData(ui::AXNodeData* node_data) {
node_data->SetName(GetAccessibleName()); node_data->SetName(GetAccessibleName());
} }
BEGIN_METADATA(LoginErrorBubble, LoginBaseBubbleView) BEGIN_METADATA(LoginErrorBubble)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -20,8 +20,9 @@ namespace ash {
// The rest of the bubble is made up of a customizable view supplied via // The rest of the bubble is made up of a customizable view supplied via
// `SetContent`. // `SetContent`.
class ASH_EXPORT LoginErrorBubble : public LoginBaseBubbleView { class ASH_EXPORT LoginErrorBubble : public LoginBaseBubbleView {
METADATA_HEADER(LoginErrorBubble, LoginBaseBubbleView)
public: public:
METADATA_HEADER(LoginErrorBubble);
LoginErrorBubble(); LoginErrorBubble();
explicit LoginErrorBubble(base::WeakPtr<views::View> anchor_view); explicit LoginErrorBubble(base::WeakPtr<views::View> anchor_view);

@@ -669,7 +669,7 @@ void LoginPasswordView::SetLoginArrowNavigationDelegate(
arrow_navigation_delegate_ = delegate; arrow_navigation_delegate_ = delegate;
} }
BEGIN_METADATA(LoginPasswordView, views::View) BEGIN_METADATA(LoginPasswordView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -58,8 +58,9 @@ class ASH_EXPORT LoginPasswordView : public views::View,
public views::TextfieldController, public views::TextfieldController,
public ImeControllerImpl::Observer, public ImeControllerImpl::Observer,
public ui::ImplicitAnimationObserver { public ui::ImplicitAnimationObserver {
METADATA_HEADER(LoginPasswordView, views::View)
public: public:
METADATA_HEADER(LoginPasswordView);
// TestApi is used for tests to get internal implementation details. // TestApi is used for tests to get internal implementation details.
class ASH_EXPORT TestApi { class ASH_EXPORT TestApi {
public: public:

@@ -99,7 +99,7 @@ void PickerContentsView::SetActivePage(views::View* view) {
} }
} }
BEGIN_METADATA(PickerContentsView, views::View) BEGIN_METADATA(PickerContentsView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -15,9 +15,9 @@ namespace ash {
// View for the main contents of the Picker. // View for the main contents of the Picker.
// Consists of multiple "pages", with at most one page visible at a time. // Consists of multiple "pages", with at most one page visible at a time.
class ASH_EXPORT PickerContentsView : public views::View { class ASH_EXPORT PickerContentsView : public views::View {
public: METADATA_HEADER(PickerContentsView, views::View)
METADATA_HEADER(PickerContentsView);
public:
// Creates an empty view with no pages. // Creates an empty view with no pages.
explicit PickerContentsView(PickerView::PickerLayoutType layout_type); explicit PickerContentsView(PickerView::PickerLayoutType layout_type);
PickerContentsView(const PickerContentsView&) = delete; PickerContentsView(const PickerContentsView&) = delete;

@@ -97,7 +97,7 @@ void PickerGifView::OnFramesFetched(
UpdateFrame(); UpdateFrame();
} }
BEGIN_METADATA(PickerGifView, views::ImageView) BEGIN_METADATA(PickerGifView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -23,7 +23,7 @@ struct AnimationFrame;
} // namespace image_util } // namespace image_util
class ASH_EXPORT PickerGifView : public views::ImageView { class ASH_EXPORT PickerGifView : public views::ImageView {
METADATA_HEADER(PickerGifView, views::View) METADATA_HEADER(PickerGifView, views::ImageView)
public: public:
using FramesFetchedCallback = using FramesFetchedCallback =

@@ -89,7 +89,7 @@ void PickerSearchFieldView::SetPlaceholderText(
textfield_->SetPlaceholderText(std::u16string(new_placeholder_text)); textfield_->SetPlaceholderText(std::u16string(new_placeholder_text));
} }
BEGIN_METADATA(PickerSearchFieldView, views::View) BEGIN_METADATA(PickerSearchFieldView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -25,9 +25,9 @@ namespace ash {
class ASH_EXPORT PickerSearchFieldView : public views::View, class ASH_EXPORT PickerSearchFieldView : public views::View,
public views::TextfieldController, public views::TextfieldController,
public views::FocusChangeListener { public views::FocusChangeListener {
public: METADATA_HEADER(PickerSearchFieldView, views::View)
METADATA_HEADER(PickerSearchFieldView);
public:
using SearchCallback = using SearchCallback =
base::RepeatingCallback<void(const std::u16string& query)>; base::RepeatingCallback<void(const std::u16string& query)>;

@@ -120,7 +120,7 @@ void PickerSearchResultsView::AddResultToSection(
result.data()); result.data());
} }
BEGIN_METADATA(PickerSearchResultsView, views::View) BEGIN_METADATA(PickerSearchResultsView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -20,9 +20,9 @@ class PickerSearchResult;
class PickerSectionView; class PickerSectionView;
class ASH_EXPORT PickerSearchResultsView : public views::View { class ASH_EXPORT PickerSearchResultsView : public views::View {
public: METADATA_HEADER(PickerSearchResultsView, views::View)
METADATA_HEADER(PickerSearchResultsView);
public:
// Indicates the user has selected a result. // Indicates the user has selected a result.
using SelectSearchResultCallback = using SelectSearchResultCallback =
base::OnceCallback<void(const PickerSearchResult& result)>; base::OnceCallback<void(const PickerSearchResult& result)>;

@@ -334,7 +334,7 @@ void PickerView::AddContentsView(PickerLayoutType layout_type) {
contents_view_->SetActivePage(zero_state_view_); contents_view_->SetActivePage(zero_state_view_);
} }
BEGIN_METADATA(PickerView, views::View) BEGIN_METADATA(PickerView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -38,9 +38,9 @@ class SystemShadow;
// View for the Picker widget. // View for the Picker widget.
class ASH_EXPORT PickerView : public views::WidgetDelegateView { class ASH_EXPORT PickerView : public views::WidgetDelegateView {
public: METADATA_HEADER(PickerView, views::WidgetDelegateView)
METADATA_HEADER(PickerView);
public:
enum class PickerLayoutType { enum class PickerLayoutType {
kResultsBelowSearchField, kResultsBelowSearchField,
kResultsAboveSearchField, kResultsAboveSearchField,

@@ -62,7 +62,7 @@ PickerSectionView* PickerZeroStateView::GetOrCreateSectionView(
return section_view; return section_view;
} }
BEGIN_METADATA(PickerZeroStateView, views::View) BEGIN_METADATA(PickerZeroStateView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -22,9 +22,9 @@ namespace ash {
class PickerSectionView; class PickerSectionView;
class ASH_EXPORT PickerZeroStateView : public views::View { class ASH_EXPORT PickerZeroStateView : public views::View {
public: METADATA_HEADER(PickerZeroStateView, views::View)
METADATA_HEADER(PickerZeroStateView);
public:
// Indicates the user has selected a category. // Indicates the user has selected a category.
using SelectCategoryCallback = using SelectCategoryCallback =
base::RepeatingCallback<void(PickerCategory category)>; base::RepeatingCallback<void(PickerCategory category)>;

@@ -43,7 +43,7 @@ ScalableIphAshNotificationView::GetHeaderRowForTesting() {
return header_row(); return header_row();
} }
BEGIN_METADATA(ScalableIphAshNotificationView, AshNotificationView) BEGIN_METADATA(ScalableIphAshNotificationView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -18,9 +18,9 @@ namespace ash {
// A customized notification view for scalable IPH that adds the summary text. // A customized notification view for scalable IPH that adds the summary text.
class ASH_EXPORT ScalableIphAshNotificationView : public AshNotificationView { class ASH_EXPORT ScalableIphAshNotificationView : public AshNotificationView {
public: METADATA_HEADER(ScalableIphAshNotificationView, AshNotificationView)
METADATA_HEADER(ScalableIphAshNotificationView);
public:
ScalableIphAshNotificationView( ScalableIphAshNotificationView(
const message_center::Notification& notification, const message_center::Notification& notification,
bool shown_in_popup); bool shown_in_popup);

@@ -102,7 +102,7 @@ void WallpaperAshNotificationView::CreatePreview() {
} }
} }
BEGIN_METADATA(WallpaperAshNotificationView, ScalableIphAshNotificationView) BEGIN_METADATA(WallpaperAshNotificationView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -26,9 +26,9 @@ class RoundedImageView;
// by showing four preview images for wallpaper. // by showing four preview images for wallpaper.
class ASH_EXPORT WallpaperAshNotificationView class ASH_EXPORT WallpaperAshNotificationView
: public ScalableIphAshNotificationView { : public ScalableIphAshNotificationView {
public: METADATA_HEADER(WallpaperAshNotificationView, ScalableIphAshNotificationView)
METADATA_HEADER(WallpaperAshNotificationView);
public:
WallpaperAshNotificationView(const message_center::Notification& notification, WallpaperAshNotificationView(const message_center::Notification& notification,
bool shown_in_popup); bool shown_in_popup);
WallpaperAshNotificationView(const WallpaperAshNotificationView&) = delete; WallpaperAshNotificationView(const WallpaperAshNotificationView&) = delete;

@@ -139,12 +139,13 @@ bool CloseButton::DoesIntersectRect(const views::View* target,
const int button_size = GetCloseButtonSize(type_); const int button_size = GetCloseButtonSize(type_);
// Only increase the hittest area for touch events (which have a non-empty // Only increase the hittest area for touch events (which have a non-empty
// bounding box), not for mouse event. // bounding box), not for mouse event.
if (!views::UsePointBasedTargeting(rect)) if (!views::UsePointBasedTargeting(rect)) {
button_bounds.Inset(gfx::Insets::VH(-button_size / 2, -button_size / 2)); button_bounds.Inset(gfx::Insets::VH(-button_size / 2, -button_size / 2));
}
return button_bounds.Intersects(rect); return button_bounds.Intersects(rect);
} }
BEGIN_METADATA(CloseButton, views::ImageButton) BEGIN_METADATA(CloseButton)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -23,9 +23,9 @@ namespace ash {
// expanded. // expanded.
class ASH_EXPORT CloseButton : public views::ImageButton, class ASH_EXPORT CloseButton : public views::ImageButton,
public views::ViewTargeterDelegate { public views::ViewTargeterDelegate {
public: METADATA_HEADER(CloseButton, views::ImageButton)
METADATA_HEADER(CloseButton);
public:
enum class Type { enum class Type {
kSmall, kSmall,
kMedium, kMedium,

@@ -339,13 +339,13 @@ IconButton::IconButton(PressedCallback callback,
IconButton::~IconButton() = default; IconButton::~IconButton() = default;
void IconButton::SetButtonBehavior(DisabledButtonBehavior button_behavior) { void IconButton::SetButtonBehavior(DisabledButtonBehavior button_behavior) {
if(button_behavior_ == button_behavior) { if (button_behavior_ == button_behavior) {
return; return;
} }
button_behavior_ = button_behavior; button_behavior_ = button_behavior;
// Change button behavior may impact the toggled state. // Change button behavior may impact the toggled state.
if(toggled_ && !GetEnabled()) { if (toggled_ && !GetEnabled()) {
UpdateVectorIcon(); UpdateVectorIcon();
} }
} }
@@ -546,9 +546,11 @@ void IconButton::UpdateBackground() {
ColorVariant color_variant = ColorVariant color_variant =
is_toggled ? background_toggled_color_ : background_color_; is_toggled ? background_toggled_color_ : background_color_;
if (absl::holds_alternative<SkColor>(color_variant)) { if (absl::holds_alternative<SkColor>(color_variant)) {
SetBackground(CreateSolidBackground(absl::get<SkColor>(color_variant), type_)); SetBackground(
CreateSolidBackground(absl::get<SkColor>(color_variant), type_));
} else { } else {
SetBackground(CreateThemedBackground(absl::get<ui::ColorId>(color_variant), type_)); SetBackground(
CreateThemedBackground(absl::get<ui::ColorId>(color_variant), type_));
} }
} }
@@ -575,7 +577,8 @@ void IconButton::UpdateBlurredBackgroundShield() {
if (absl::holds_alternative<SkColor>(color_variant)) { if (absl::holds_alternative<SkColor>(color_variant)) {
blurred_background_shield_->SetColor(absl::get<SkColor>(color_variant)); blurred_background_shield_->SetColor(absl::get<SkColor>(color_variant));
} else { } else {
blurred_background_shield_->SetColorId(absl::get<ui::ColorId>(color_variant)); blurred_background_shield_->SetColorId(
absl::get<ui::ColorId>(color_variant));
} }
} }
@@ -645,7 +648,7 @@ bool IconButton::IsToggledOn() const {
DisabledButtonBehavior::kCanDisplayDisabledToggleValue); DisabledButtonBehavior::kCanDisplayDisabledToggleValue);
} }
BEGIN_METADATA(IconButton, views::ImageButton) BEGIN_METADATA(IconButton)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -37,9 +37,9 @@ class BlurredBackgroundShield;
// this is done to help differentiating focus ring from the content of the // this is done to help differentiating focus ring from the content of the
// button. // button.
class ASH_EXPORT IconButton : public views::ImageButton { class ASH_EXPORT IconButton : public views::ImageButton {
public: METADATA_HEADER(IconButton, views::ImageButton)
METADATA_HEADER(IconButton);
public:
using ColorVariant = absl::variant<SkColor, ui::ColorId>; using ColorVariant = absl::variant<SkColor, ui::ColorId>;
enum class Type { enum class Type {

@@ -42,14 +42,16 @@ OptionButtonBase::OptionButtonBase(int button_width,
OptionButtonBase::~OptionButtonBase() = default; OptionButtonBase::~OptionButtonBase() = default;
void OptionButtonBase::SetSelected(bool selected) { void OptionButtonBase::SetSelected(bool selected) {
if (selected_ == selected) if (selected_ == selected) {
return; return;
}
selected_ = selected; selected_ = selected;
UpdateImage(); UpdateImage();
if (delegate_) if (delegate_) {
delegate_->OnButtonSelected(this); delegate_->OnButtonSelected(this);
}
NotifyAccessibilityEvent(ax::mojom::Event::kCheckedStateChanged, NotifyAccessibilityEvent(ax::mojom::Event::kCheckedStateChanged,
/*send_native_event=*/true); /*send_native_event=*/true);
@@ -111,8 +113,9 @@ void OptionButtonBase::OnThemeChanged() {
} }
void OptionButtonBase::NotifyClick(const ui::Event& event) { void OptionButtonBase::NotifyClick(const ui::Event& event) {
if (delegate_) if (delegate_) {
delegate_->OnButtonClicked(this); delegate_->OnButtonClicked(this);
}
views::LabelButton::NotifyClick(event); views::LabelButton::NotifyClick(event);
} }
@@ -148,7 +151,7 @@ void OptionButtonBase::UpdateTextColor() {
color_provider->GetColor(KColorAshTextDisabledColor)); color_provider->GetColor(KColorAshTextDisabledColor));
} }
BEGIN_METADATA(OptionButtonBase, views::LabelButton) BEGIN_METADATA(OptionButtonBase)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -18,9 +18,9 @@ struct VectorIcon;
namespace ash { namespace ash {
class ASH_EXPORT OptionButtonBase : public views::LabelButton { class ASH_EXPORT OptionButtonBase : public views::LabelButton {
public: METADATA_HEADER(OptionButtonBase, views::LabelButton)
METADATA_HEADER(OptionButtonBase);
public:
// The default padding for the button if the client doesn't explicitly set // The default padding for the button if the client doesn't explicitly set
// one. // one.
static constexpr auto kDefaultPadding = gfx::Insets::TLBR(8, 12, 8, 12); static constexpr auto kDefaultPadding = gfx::Insets::TLBR(8, 12, 8, 12);

@@ -57,7 +57,7 @@ bool RadioButton::IsIconOnTheLeftSide() {
return icon_direction_ == IconDirection::kLeading; return icon_direction_ == IconDirection::kLeading;
} }
BEGIN_METADATA(RadioButton, OptionButtonBase) BEGIN_METADATA(RadioButton)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -21,9 +21,9 @@ namespace ash {
// left or right side, check icon on left or right side. It's usually used in // left or right side, check icon on left or right side. It's usually used in
// the group of radio buttons. Please refer `RadioButtonGroup` for more details. // the group of radio buttons. Please refer `RadioButtonGroup` for more details.
class ASH_EXPORT RadioButton : public OptionButtonBase { class ASH_EXPORT RadioButton : public OptionButtonBase {
public: METADATA_HEADER(RadioButton, OptionButtonBase)
METADATA_HEADER(RadioButton);
public:
enum class IconDirection { enum class IconDirection {
kLeading, kLeading,
kFollowing, kFollowing,

@@ -50,12 +50,14 @@ RadioButton* RadioButtonGroup::AddButton(RadioButton::PressedCallback callback,
} }
void RadioButtonGroup::OnButtonSelected(OptionButtonBase* button) { void RadioButtonGroup::OnButtonSelected(OptionButtonBase* button) {
if (!button->selected()) if (!button->selected()) {
return; return;
}
for (ash::OptionButtonBase* b : buttons_) { for (ash::OptionButtonBase* b : buttons_) {
if (b != button) if (b != button) {
b->SetSelected(false); b->SetSelected(false);
}
} }
button->ScrollViewToVisible(); button->ScrollViewToVisible();
} }
@@ -64,7 +66,7 @@ void RadioButtonGroup::OnButtonClicked(OptionButtonBase* button) {
button->SetSelected(true); button->SetSelected(true);
} }
BEGIN_METADATA(RadioButtonGroup, OptionButtonGroup) BEGIN_METADATA(RadioButtonGroup)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -20,9 +20,9 @@ namespace ash {
// buttons. If they're not provided, the default values will be applied. // buttons. If they're not provided, the default values will be applied.
class ASH_EXPORT RadioButtonGroup : public OptionButtonGroup, class ASH_EXPORT RadioButtonGroup : public OptionButtonGroup,
public OptionButtonBase::Delegate { public OptionButtonBase::Delegate {
public: METADATA_HEADER(RadioButtonGroup, OptionButtonGroup)
METADATA_HEADER(RadioButtonGroup);
public:
explicit RadioButtonGroup(int group_width); explicit RadioButtonGroup(int group_width);
RadioButtonGroup(int group_width, RadioButtonGroup(int group_width,

@@ -62,7 +62,7 @@ gfx::RoundedCornersF RoundedContainer::GetRoundedCorners() {
} }
} }
BEGIN_METADATA(RoundedContainer, views::View); BEGIN_METADATA(RoundedContainer);
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -18,9 +18,9 @@ namespace ash {
// A rounded countainer which can be used in any list views to carry the items. // A rounded countainer which can be used in any list views to carry the items.
// It provides 4 `Behavior` styles. // It provides 4 `Behavior` styles.
class ASH_EXPORT RoundedContainer : public views::View { class ASH_EXPORT RoundedContainer : public views::View {
public: METADATA_HEADER(RoundedContainer, views::View)
METADATA_HEADER(RoundedContainer);
public:
// The default empty border insets. // The default empty border insets.
static constexpr gfx::Insets kBorderInsets = gfx::Insets::VH(8, 0); static constexpr gfx::Insets kBorderInsets = gfx::Insets::VH(8, 0);

@@ -71,7 +71,7 @@ gfx::Rect Switch::GetThumbBounds() const {
return bounds; return bounds;
} }
BEGIN_METADATA(Switch, views::ToggleButton) BEGIN_METADATA(Switch)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -12,9 +12,9 @@
namespace ash { namespace ash {
class ASH_EXPORT Switch : public views::ToggleButton { class ASH_EXPORT Switch : public views::ToggleButton {
public: METADATA_HEADER(Switch, views::ToggleButton)
METADATA_HEADER(Switch);
public:
explicit Switch(PressedCallback callback = PressedCallback()); explicit Switch(PressedCallback callback = PressedCallback());
Switch(const Switch&) = delete; Switch(const Switch&) = delete;
Switch& operator=(const Switch&) = delete; Switch& operator=(const Switch&) = delete;

@@ -357,7 +357,7 @@ void SystemTextfield::UpdateTextColor() {
placeholder_text_color_id_.value_or(cros_tokens::kCrosSysDisabled))); placeholder_text_color_id_.value_or(cros_tokens::kCrosSysDisabled)));
} }
BEGIN_METADATA(SystemTextfield, views::Textfield) BEGIN_METADATA(SystemTextfield)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -18,9 +18,9 @@ namespace ash {
// SystemTextfield is an extension of `Views::Textfield` used for system UIs. It // SystemTextfield is an extension of `Views::Textfield` used for system UIs. It
// has specific small, medium, and large types and applies dynamic colors. // has specific small, medium, and large types and applies dynamic colors.
class ASH_EXPORT SystemTextfield : public views::Textfield { class ASH_EXPORT SystemTextfield : public views::Textfield {
public: METADATA_HEADER(SystemTextfield, views::Textfield)
METADATA_HEADER(SystemTextfield);
public:
enum class Type { enum class Type {
kSmall, kSmall,
kMedium, kMedium,

@@ -218,7 +218,7 @@ void TabSlider::OnEnabledStateChanged() {
SchedulePaint(); SchedulePaint();
} }
BEGIN_METADATA(TabSlider, views::View) BEGIN_METADATA(TabSlider)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -24,9 +24,9 @@ class TabSliderButton;
// selected, the selector will move from the position of previously selected // selected, the selector will move from the position of previously selected
// button to the position of currently selected button. // button to the position of currently selected button.
class ASH_EXPORT TabSlider : public views::TableLayoutView { class ASH_EXPORT TabSlider : public views::TableLayoutView {
public: METADATA_HEADER(TabSlider, views::TableLayoutView)
METADATA_HEADER(TabSlider);
public:
// The init parameters used to initialize the layout, appearance, and behavior // The init parameters used to initialize the layout, appearance, and behavior
// of the tab slider. // of the tab slider.
struct InitParams { struct InitParams {

@@ -115,7 +115,7 @@ void TabSliderButton::NotifyClick(const ui::Event& event) {
views::Button::NotifyClick(event); views::Button::NotifyClick(event);
} }
BEGIN_METADATA(TabSliderButton, views::Button) BEGIN_METADATA(TabSliderButton)
END_METADATA END_METADATA
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -161,7 +161,7 @@ void IconSliderButton::PaintButtonContents(gfx::Canvas* canvas) {
canvas->DrawImageInt(img, origin_offset, origin_offset); canvas->DrawImageInt(img, origin_offset, origin_offset);
} }
BEGIN_METADATA(IconSliderButton, TabSliderButton) BEGIN_METADATA(IconSliderButton)
END_METADATA END_METADATA
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -219,7 +219,7 @@ void LabelSliderButton::StateChanged(ButtonState old_state) {
UpdateLabelColor(); UpdateLabelColor();
} }
BEGIN_METADATA(LabelSliderButton, TabSliderButton) BEGIN_METADATA(LabelSliderButton)
END_METADATA END_METADATA
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -269,7 +269,7 @@ void IconLabelSliderButton::OnSelectedChanged() {
UpdateColors(); UpdateColors();
} }
BEGIN_METADATA(IconLabelSliderButton, TabSliderButton) BEGIN_METADATA(IconLabelSliderButton)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -32,9 +32,9 @@ namespace ash {
// selected. After a button is added to a tab slider, selecting the button will // selected. After a button is added to a tab slider, selecting the button will
// deselect the other buttons in the tab slider. // deselect the other buttons in the tab slider.
class ASH_EXPORT TabSliderButton : public views::Button { class ASH_EXPORT TabSliderButton : public views::Button {
public: METADATA_HEADER(TabSliderButton, views::Button)
METADATA_HEADER(TabSliderButton);
public:
TabSliderButton(PressedCallback callback, const std::u16string& tooltip_text); TabSliderButton(PressedCallback callback, const std::u16string& tooltip_text);
TabSliderButton(const TabSliderButton&) = delete; TabSliderButton(const TabSliderButton&) = delete;
TabSliderButton& operator=(const TabSliderButton&) = delete; TabSliderButton& operator=(const TabSliderButton&) = delete;
@@ -71,9 +71,9 @@ class ASH_EXPORT TabSliderButton : public views::Button {
// the center. The icon has different color schemes for selected, unselected, // the center. The icon has different color schemes for selected, unselected,
// and disabled states. // and disabled states.
class ASH_EXPORT IconSliderButton : public TabSliderButton { class ASH_EXPORT IconSliderButton : public TabSliderButton {
public: METADATA_HEADER(IconSliderButton, TabSliderButton)
METADATA_HEADER(IconSliderButton);
public:
IconSliderButton(PressedCallback callback, IconSliderButton(PressedCallback callback,
const gfx::VectorIcon* icon, const gfx::VectorIcon* icon,
const std::u16string& tooltip_text_base = u""); const std::u16string& tooltip_text_base = u"");
@@ -96,9 +96,9 @@ class ASH_EXPORT IconSliderButton : public TabSliderButton {
// in the center. The label text has different color schemes for selected, // in the center. The label text has different color schemes for selected,
// unselected, and disabled states. // unselected, and disabled states.
class ASH_EXPORT LabelSliderButton : public TabSliderButton { class ASH_EXPORT LabelSliderButton : public TabSliderButton {
public: METADATA_HEADER(LabelSliderButton, TabSliderButton)
METADATA_HEADER(LabelSliderButton);
public:
LabelSliderButton(PressedCallback callback, LabelSliderButton(PressedCallback callback,
const std::u16string& text, const std::u16string& text,
const std::u16string& tooltip_text_base = u""); const std::u16string& tooltip_text_base = u"");
@@ -124,9 +124,9 @@ class ASH_EXPORT LabelSliderButton : public TabSliderButton {
// A `TabSliderButton` which shows an icon above a label. // A `TabSliderButton` which shows an icon above a label.
class ASH_EXPORT IconLabelSliderButton : public TabSliderButton { class ASH_EXPORT IconLabelSliderButton : public TabSliderButton {
public: METADATA_HEADER(IconLabelSliderButton, TabSliderButton)
METADATA_HEADER(IconLabelSliderButton);
public:
static constexpr TabSlider::InitParams kSliderParams{ static constexpr TabSlider::InitParams kSliderParams{
/*internal_border_padding=*/4, /*internal_border_padding=*/4,
/*between_child_spacing=*/0, /*between_child_spacing=*/0,

@@ -74,8 +74,9 @@ FloatingMenuButton::FloatingMenuButton(views::Button::PressedCallback callback,
FloatingMenuButton::~FloatingMenuButton() = default; FloatingMenuButton::~FloatingMenuButton() = default;
void FloatingMenuButton::SetVectorIcon(const gfx::VectorIcon& icon) { void FloatingMenuButton::SetVectorIcon(const gfx::VectorIcon& icon) {
if (icon_ == &icon) if (icon_ == &icon) {
return; return;
}
icon_ = &icon; icon_ = &icon;
UpdateImage(); UpdateImage();
} }
@@ -85,8 +86,9 @@ bool FloatingMenuButton::GetA11yTogglable() const {
} }
void FloatingMenuButton::SetA11yTogglable(bool a11y_togglable) { void FloatingMenuButton::SetA11yTogglable(bool a11y_togglable) {
if (a11y_togglable == is_a11y_togglable_) if (a11y_togglable == is_a11y_togglable_) {
return; return;
}
is_a11y_togglable_ = a11y_togglable; is_a11y_togglable_ = a11y_togglable;
OnPropertyChanged(&is_a11y_togglable_, views::kPropertyEffectsPaint); OnPropertyChanged(&is_a11y_togglable_, views::kPropertyEffectsPaint);
} }
@@ -96,8 +98,9 @@ bool FloatingMenuButton::GetDrawHighlight() const {
} }
void FloatingMenuButton::SetDrawHighlight(bool draw_highlight) { void FloatingMenuButton::SetDrawHighlight(bool draw_highlight) {
if (draw_highlight_ == draw_highlight) if (draw_highlight_ == draw_highlight) {
return; return;
}
draw_highlight_ = draw_highlight; draw_highlight_ = draw_highlight;
OnPropertyChanged(&draw_highlight_, views::kPropertyEffectsPaint); OnPropertyChanged(&draw_highlight_, views::kPropertyEffectsPaint);
} }
@@ -107,8 +110,9 @@ bool FloatingMenuButton::GetToggled() const {
} }
void FloatingMenuButton::SetToggled(bool toggled) { void FloatingMenuButton::SetToggled(bool toggled) {
if (toggled_ == toggled) if (toggled_ == toggled) {
return; return;
}
toggled_ = toggled; toggled_ = toggled;
UpdateImage(); UpdateImage();
OnPropertyChanged(&toggled_, views::PropertyEffects::kPropertyEffectsPaint); OnPropertyChanged(&toggled_, views::PropertyEffects::kPropertyEffectsPaint);
@@ -134,11 +138,13 @@ gfx::Size FloatingMenuButton::CalculatePreferredSize() const {
} }
void FloatingMenuButton::GetAccessibleNodeData(ui::AXNodeData* node_data) { void FloatingMenuButton::GetAccessibleNodeData(ui::AXNodeData* node_data) {
if (!GetEnabled()) if (!GetEnabled()) {
return; return;
}
views::ImageButton::GetAccessibleNodeData(node_data); views::ImageButton::GetAccessibleNodeData(node_data);
if (!is_a11y_togglable_) if (!is_a11y_togglable_) {
return; return;
}
node_data->role = ax::mojom::Role::kToggleButton; node_data->role = ax::mojom::Role::kToggleButton;
node_data->SetCheckedState(toggled_ ? ax::mojom::CheckedState::kTrue node_data->SetCheckedState(toggled_ ? ax::mojom::CheckedState::kTrue
: ax::mojom::CheckedState::kFalse); : ax::mojom::CheckedState::kFalse);
@@ -155,7 +161,7 @@ void FloatingMenuButton::UpdateImage() {
ui::ImageModel::FromVectorIcon(*icon_, kColorAshButtonIconDisabledColor)); ui::ImageModel::FromVectorIcon(*icon_, kColorAshButtonIconDisabledColor));
} }
BEGIN_METADATA(FloatingMenuButton, views::ImageButton) BEGIN_METADATA(FloatingMenuButton)
ADD_PROPERTY_METADATA(bool, A11yTogglable) ADD_PROPERTY_METADATA(bool, A11yTogglable)
ADD_PROPERTY_METADATA(bool, DrawHighlight) ADD_PROPERTY_METADATA(bool, DrawHighlight)
ADD_PROPERTY_METADATA(bool, Toggled) ADD_PROPERTY_METADATA(bool, Toggled)

@@ -22,9 +22,9 @@ namespace ash {
// Button view that is used in floating menu. // Button view that is used in floating menu.
class FloatingMenuButton : public views::ImageButton { class FloatingMenuButton : public views::ImageButton {
public: METADATA_HEADER(FloatingMenuButton, views::ImageButton)
METADATA_HEADER(FloatingMenuButton);
public:
FloatingMenuButton(); FloatingMenuButton();
FloatingMenuButton(views::Button::PressedCallback callback, FloatingMenuButton(views::Button::PressedCallback callback,
const gfx::VectorIcon& icon, const gfx::VectorIcon& icon,

@@ -61,17 +61,19 @@ int SwitchAccessBackButtonView::GetFocusRingWidthPerSide() {
} }
void SwitchAccessBackButtonView::SetFocusRing(bool should_show) { void SwitchAccessBackButtonView::SetFocusRing(bool should_show) {
if (show_focus_ring_ == should_show) if (show_focus_ring_ == should_show) {
return; return;
}
show_focus_ring_ = should_show; show_focus_ring_ = should_show;
SchedulePaint(); SchedulePaint();
} }
void SwitchAccessBackButtonView::SetForMenu(bool for_menu) { void SwitchAccessBackButtonView::SetForMenu(bool for_menu) {
if (for_menu) if (for_menu) {
back_button_->SetVectorIcon(kSwitchAccessCloseIcon); back_button_->SetVectorIcon(kSwitchAccessCloseIcon);
else } else {
back_button_->SetVectorIcon(kSwitchAccessBackIcon); back_button_->SetVectorIcon(kSwitchAccessBackIcon);
}
} }
void SwitchAccessBackButtonView::GetAccessibleNodeData( void SwitchAccessBackButtonView::GetAccessibleNodeData(
@@ -92,8 +94,9 @@ void SwitchAccessBackButtonView::OnPaint(gfx::Canvas* canvas) {
flags.setStyle(cc::PaintFlags::kFill_Style); flags.setStyle(cc::PaintFlags::kFill_Style);
canvas->DrawCircle(gfx::PointF(rect.CenterPoint()), kRadiusDp, flags); canvas->DrawCircle(gfx::PointF(rect.CenterPoint()), kRadiusDp, flags);
if (!show_focus_ring_) if (!show_focus_ring_) {
return; return;
}
flags.setColor( flags.setColor(
color_provider->GetColor(kColorAshSwitchAccessInnerStrokeColor)); color_provider->GetColor(kColorAshSwitchAccessInnerStrokeColor));
@@ -113,7 +116,7 @@ void SwitchAccessBackButtonView::OnButtonPressed() {
/*send_native_event=*/false); /*send_native_event=*/false);
} }
BEGIN_METADATA(SwitchAccessBackButtonView, views::BoxLayoutView) BEGIN_METADATA(SwitchAccessBackButtonView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -17,9 +17,9 @@ class FloatingMenuButton;
// View for the Switch Access Back Button. // View for the Switch Access Back Button.
class SwitchAccessBackButtonView : public views::BoxLayoutView { class SwitchAccessBackButtonView : public views::BoxLayoutView {
public: METADATA_HEADER(SwitchAccessBackButtonView, views::BoxLayoutView)
METADATA_HEADER(SwitchAccessBackButtonView);
public:
explicit SwitchAccessBackButtonView(bool for_menu); explicit SwitchAccessBackButtonView(bool for_menu);
~SwitchAccessBackButtonView() override = default; ~SwitchAccessBackButtonView() override = default;

@@ -972,7 +972,7 @@ void AudioDetailedView::OnNumStreamIgnoreUiGainsChanged(int32_t num) {
UpdateAgcInfoRow(); UpdateAgcInfoRow();
} }
BEGIN_METADATA(AudioDetailedView, TrayDetailedView) BEGIN_METADATA(AudioDetailedView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -44,9 +44,9 @@ class ASH_EXPORT AudioDetailedView
public SessionObserver, public SessionObserver,
public speech::SodaInstaller::Observer, public speech::SodaInstaller::Observer,
public TrayDetailedView { public TrayDetailedView {
public: METADATA_HEADER(AudioDetailedView, TrayDetailedView)
METADATA_HEADER(AudioDetailedView);
public:
explicit AudioDetailedView(DetailedViewDelegate* delegate); explicit AudioDetailedView(DetailedViewDelegate* delegate);
AudioDetailedView(const AudioDetailedView&) = delete; AudioDetailedView(const AudioDetailedView&) = delete;

@@ -218,7 +218,7 @@ void MicGainSliderView::VisibilityChanged(View* starting_from,
} }
} }
BEGIN_METADATA(MicGainSliderView, views::View) BEGIN_METADATA(MicGainSliderView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -15,9 +15,9 @@ class MicGainSliderController;
class MicGainSliderView : public UnifiedSliderView, class MicGainSliderView : public UnifiedSliderView,
public CrasAudioHandler::AudioObserver { public CrasAudioHandler::AudioObserver {
public: METADATA_HEADER(MicGainSliderView, UnifiedSliderView)
METADATA_HEADER(MicGainSliderView);
public:
explicit MicGainSliderView(MicGainSliderController* controller); explicit MicGainSliderView(MicGainSliderController* controller);
MicGainSliderView(MicGainSliderController* controller, MicGainSliderView(MicGainSliderController* controller,
uint64_t device_id, uint64_t device_id,

@@ -108,8 +108,9 @@ const std::u16string GetDeviceBatteryA11yText(
if (!battery_properties) { if (!battery_properties) {
return; return;
} }
if (!battery_text.empty()) if (!battery_text.empty()) {
battery_text = base::StrCat({battery_text, u" "}); battery_text = base::StrCat({battery_text, u" "});
}
battery_text = base::StrCat( battery_text = base::StrCat(
{battery_text, {battery_text,
l10n_util::GetStringFUTF16( l10n_util::GetStringFUTF16(
@@ -254,8 +255,9 @@ void BluetoothDeviceListItemView::UpdateAccessibleName(
const std::u16string battery_text = GetDeviceBatteryA11yText( const std::u16string battery_text = GetDeviceBatteryA11yText(
device_properties_->device_properties->battery_info); device_properties_->device_properties->battery_info);
if (!battery_text.empty()) if (!battery_text.empty()) {
a11y_text = base::StrCat({a11y_text, u" ", battery_text}); a11y_text = base::StrCat({a11y_text, u" ", battery_text});
}
SetAccessibleName(a11y_text); SetAccessibleName(a11y_text);
} }
@@ -333,7 +335,7 @@ void BluetoothDeviceListItemView::UpdateSingleBatteryView(
IDS_ASH_STATUS_TRAY_BLUETOOTH_DEVICE_BATTERY_PERCENTAGE_ONLY_LABEL); IDS_ASH_STATUS_TRAY_BLUETOOTH_DEVICE_BATTERY_PERCENTAGE_ONLY_LABEL);
} }
BEGIN_METADATA(BluetoothDeviceListItemView, HoverHighlightView) BEGIN_METADATA(BluetoothDeviceListItemView)
END_METADATA END_METADATA
} // namespace ash } // namespace ash

@@ -17,8 +17,9 @@ class ViewClickListener;
// This class encapsulates the logic of configuring the view shown for a single // This class encapsulates the logic of configuring the view shown for a single
// device in the detailed Bluetooth page within the quick settings. // device in the detailed Bluetooth page within the quick settings.
class ASH_EXPORT BluetoothDeviceListItemView : public HoverHighlightView { class ASH_EXPORT BluetoothDeviceListItemView : public HoverHighlightView {
METADATA_HEADER(BluetoothDeviceListItemView, HoverHighlightView)
public: public:
METADATA_HEADER(BluetoothDeviceListItemView);
explicit BluetoothDeviceListItemView(ViewClickListener* listener); explicit BluetoothDeviceListItemView(ViewClickListener* listener);
BluetoothDeviceListItemView(const BluetoothDeviceListItemView&) = delete; BluetoothDeviceListItemView(const BluetoothDeviceListItemView&) = delete;
BluetoothDeviceListItemView& operator=(const BluetoothDeviceListItemView&) = BluetoothDeviceListItemView& operator=(const BluetoothDeviceListItemView&) =

@@ -57,8 +57,9 @@ class COMPONENT_EXPORT(CHROMEOS_UI_FRAME) FrameHeader
class FrameAnimatorView : public views::View, class FrameAnimatorView : public views::View,
public views::ViewObserver, public views::ViewObserver,
public ui::ImplicitAnimationObserver { public ui::ImplicitAnimationObserver {
METADATA_HEADER(FrameAnimatorView, views::View)
public: public:
METADATA_HEADER(FrameAnimatorView);
explicit FrameAnimatorView(views::View* parent); explicit FrameAnimatorView(views::View* parent);
FrameAnimatorView(const FrameAnimatorView&) = delete; FrameAnimatorView(const FrameAnimatorView&) = delete;
FrameAnimatorView& operator=(const FrameAnimatorView&) = delete; FrameAnimatorView& operator=(const FrameAnimatorView&) = delete;