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 -----------------------------------------------------
class AssistantOptInContainer : public views::Button {
public:
METADATA_HEADER(AssistantOptInContainer);
METADATA_HEADER(AssistantOptInContainer, views::Button)
public:
explicit AssistantOptInContainer(views::Button::PressedCallback callback)
: views::Button(std::move(callback)) {
constexpr float kHighlightOpacity = 0.06f;
@ -89,7 +89,7 @@ class AssistantOptInContainer : public views::Button {
}
};
BEGIN_METADATA(AssistantOptInContainer, views::Button)
BEGIN_METADATA(AssistantOptInContainer)
END_METADATA
} // namespace

@ -47,9 +47,9 @@ constexpr int kScrollIndicatorHeightDip = 1;
// thickness to 0 with ScrollView::SetCustomOverflowIndicator. This view is not
// visible.
class ObservableOverflowIndicator : public views::View {
public:
METADATA_HEADER(ObservableOverflowIndicator);
METADATA_HEADER(ObservableOverflowIndicator, views::View)
public:
explicit ObservableOverflowIndicator(
UiElementContainerView* 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;
};
BEGIN_METADATA(ObservableOverflowIndicator, views::View)
BEGIN_METADATA(ObservableOverflowIndicator)
END_METADATA
// 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
// transparent, i.e. it becomes visible if you set thickness larger than 0.
class InvisibleOverflowIndicator : public views::View {
public:
METADATA_HEADER(InvisibleOverflowIndicator);
METADATA_HEADER(InvisibleOverflowIndicator, views::View)
};
BEGIN_METADATA(InvisibleOverflowIndicator, views::View)
BEGIN_METADATA(InvisibleOverflowIndicator)
END_METADATA
} // namespace

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

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

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

@ -24,9 +24,9 @@ namespace ash {
// 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).
class ASH_EXPORT ImeModeIndicatorView : public views::BubbleDialogDelegateView {
public:
METADATA_HEADER(ImeModeIndicatorView);
METADATA_HEADER(ImeModeIndicatorView, views::BubbleDialogDelegateView)
public:
// The cursor bounds is in the universal screen coordinates in DIP.
ImeModeIndicatorView(const gfx::Rect& cursor_bounds,
const std::u16string& label);

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

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

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

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

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

@ -44,9 +44,9 @@ class ASH_EXPORT LockScreenMediaControlsView
public media_session::mojom::MediaControllerImageObserver,
public base::PowerSuspendObserver,
public ui::ImplicitAnimationObserver {
public:
METADATA_HEADER(LockScreenMediaControlsView);
METADATA_HEADER(LockScreenMediaControlsView, views::View)
public:
using MediaControlsEnabled = base::RepeatingCallback<bool()>;
// 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());
}
BEGIN_METADATA(LoginErrorBubble, LoginBaseBubbleView)
BEGIN_METADATA(LoginErrorBubble)
END_METADATA
} // namespace ash

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@ -139,12 +139,13 @@ bool CloseButton::DoesIntersectRect(const views::View* target,
const int button_size = GetCloseButtonSize(type_);
// Only increase the hittest area for touch events (which have a non-empty
// 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));
}
return button_bounds.Intersects(rect);
}
BEGIN_METADATA(CloseButton, views::ImageButton)
BEGIN_METADATA(CloseButton)
END_METADATA
} // namespace ash

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

@ -339,13 +339,13 @@ IconButton::IconButton(PressedCallback callback,
IconButton::~IconButton() = default;
void IconButton::SetButtonBehavior(DisabledButtonBehavior button_behavior) {
if(button_behavior_ == button_behavior) {
if (button_behavior_ == button_behavior) {
return;
}
button_behavior_ = button_behavior;
// Change button behavior may impact the toggled state.
if(toggled_ && !GetEnabled()) {
if (toggled_ && !GetEnabled()) {
UpdateVectorIcon();
}
}
@ -546,9 +546,11 @@ void IconButton::UpdateBackground() {
ColorVariant color_variant =
is_toggled ? background_toggled_color_ : background_color_;
if (absl::holds_alternative<SkColor>(color_variant)) {
SetBackground(CreateSolidBackground(absl::get<SkColor>(color_variant), type_));
SetBackground(
CreateSolidBackground(absl::get<SkColor>(color_variant), type_));
} 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)) {
blurred_background_shield_->SetColor(absl::get<SkColor>(color_variant));
} 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);
}
BEGIN_METADATA(IconButton, views::ImageButton)
BEGIN_METADATA(IconButton)
END_METADATA
} // namespace ash

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

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

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

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

@ -21,9 +21,9 @@ namespace ash {
// 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.
class ASH_EXPORT RadioButton : public OptionButtonBase {
public:
METADATA_HEADER(RadioButton);
METADATA_HEADER(RadioButton, OptionButtonBase)
public:
enum class IconDirection {
kLeading,
kFollowing,

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

@ -20,9 +20,9 @@ namespace ash {
// buttons. If they're not provided, the default values will be applied.
class ASH_EXPORT RadioButtonGroup : public OptionButtonGroup,
public OptionButtonBase::Delegate {
public:
METADATA_HEADER(RadioButtonGroup);
METADATA_HEADER(RadioButtonGroup, OptionButtonGroup)
public:
explicit 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
} // namespace ash

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

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

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

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

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

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

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

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

@ -32,9 +32,9 @@ namespace ash {
// selected. After a button is added to a tab slider, selecting the button will
// deselect the other buttons in the tab slider.
class ASH_EXPORT TabSliderButton : public views::Button {
public:
METADATA_HEADER(TabSliderButton);
METADATA_HEADER(TabSliderButton, views::Button)
public:
TabSliderButton(PressedCallback callback, const std::u16string& tooltip_text);
TabSliderButton(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,
// and disabled states.
class ASH_EXPORT IconSliderButton : public TabSliderButton {
public:
METADATA_HEADER(IconSliderButton);
METADATA_HEADER(IconSliderButton, TabSliderButton)
public:
IconSliderButton(PressedCallback callback,
const gfx::VectorIcon* icon,
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,
// unselected, and disabled states.
class ASH_EXPORT LabelSliderButton : public TabSliderButton {
public:
METADATA_HEADER(LabelSliderButton);
METADATA_HEADER(LabelSliderButton, TabSliderButton)
public:
LabelSliderButton(PressedCallback callback,
const std::u16string& text,
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.
class ASH_EXPORT IconLabelSliderButton : public TabSliderButton {
public:
METADATA_HEADER(IconLabelSliderButton);
METADATA_HEADER(IconLabelSliderButton, TabSliderButton)
public:
static constexpr TabSlider::InitParams kSliderParams{
/*internal_border_padding=*/4,
/*between_child_spacing=*/0,

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

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

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

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

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

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

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

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

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

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

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