Commit a7c81b03 authored by Peter Kasting's avatar Peter Kasting Committed by Chromium LUCI CQ

Add metadata for various View subclasses that lack it, 1/n

Bug: 1159562
Change-Id: I59929dd816008c69bd82930e6834529218fde15d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2644705
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#846385}
parent 2966f7dc
...@@ -51,6 +51,8 @@ ...@@ -51,6 +51,8 @@
#include "ui/views/layout/box_layout.h" #include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h" #include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/flex_layout.h" #include "ui/views/layout/flex_layout.h"
#include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/metadata/metadata_impl_macros.h"
#include "ui/views/style/typography.h" #include "ui/views/style/typography.h"
#include "ui/views/style/typography_provider.h" #include "ui/views/style/typography_provider.h"
#include "ui/views/view.h" #include "ui/views/view.h"
...@@ -210,7 +212,10 @@ namespace { ...@@ -210,7 +212,10 @@ namespace {
// specified maximum. // specified maximum.
class ConstrainedWidthView : public views::View { class ConstrainedWidthView : public views::View {
public: public:
METADATA_HEADER(ConstrainedWidthView);
ConstrainedWidthView(std::unique_ptr<views::View> child, int max_width); ConstrainedWidthView(std::unique_ptr<views::View> child, int max_width);
ConstrainedWidthView(const ConstrainedWidthView&) = delete;
ConstrainedWidthView& operator=(const ConstrainedWidthView&) = delete;
~ConstrainedWidthView() override = default; ~ConstrainedWidthView() override = default;
private: private:
...@@ -218,8 +223,6 @@ class ConstrainedWidthView : public views::View { ...@@ -218,8 +223,6 @@ class ConstrainedWidthView : public views::View {
gfx::Size CalculatePreferredSize() const override; gfx::Size CalculatePreferredSize() const override;
int max_width_; int max_width_;
DISALLOW_COPY_AND_ASSIGN(ConstrainedWidthView);
}; };
ConstrainedWidthView::ConstrainedWidthView(std::unique_ptr<views::View> child, ConstrainedWidthView::ConstrainedWidthView(std::unique_ptr<views::View> child,
...@@ -236,11 +239,15 @@ gfx::Size ConstrainedWidthView::CalculatePreferredSize() const { ...@@ -236,11 +239,15 @@ gfx::Size ConstrainedWidthView::CalculatePreferredSize() const {
return gfx::Size(max_width_, GetHeightForWidth(max_width_)); return gfx::Size(max_width_, GetHeightForWidth(max_width_));
} }
BEGIN_METADATA(ConstrainedWidthView, views::View)
END_METADATA
// This represents a single selectable item. Subclasses distinguish between // This represents a single selectable item. Subclasses distinguish between
// footer and suggestion rows, which are structurally similar but have // footer and suggestion rows, which are structurally similar but have
// distinct styling. // distinct styling.
class AutofillPopupItemView : public AutofillPopupRowView { class AutofillPopupItemView : public AutofillPopupRowView {
public: public:
METADATA_HEADER(AutofillPopupItemView);
~AutofillPopupItemView() override = default; ~AutofillPopupItemView() override = default;
// views::View: // views::View:
...@@ -266,7 +273,7 @@ class AutofillPopupItemView : public AutofillPopupRowView { ...@@ -266,7 +273,7 @@ class AutofillPopupItemView : public AutofillPopupRowView {
void RefreshStyle() override; void RefreshStyle() override;
std::unique_ptr<views::Background> CreateBackground() final; std::unique_ptr<views::Background> CreateBackground() final;
int frontend_id() const { return frontend_id_; } int GetFrontendId() const;
virtual int GetPrimaryTextStyle() = 0; virtual int GetPrimaryTextStyle() = 0;
// Returns a value view. The label part is optional but allow caller to keep // Returns a value view. The label part is optional but allow caller to keep
...@@ -301,10 +308,22 @@ class AutofillPopupItemView : public AutofillPopupRowView { ...@@ -301,10 +308,22 @@ class AutofillPopupItemView : public AutofillPopupRowView {
std::vector<views::Label*> inner_labels_; std::vector<views::Label*> inner_labels_;
}; };
int AutofillPopupItemView::GetFrontendId() const {
return frontend_id_;
}
BEGIN_METADATA(AutofillPopupItemView, AutofillPopupRowView)
ADD_READONLY_PROPERTY_METADATA(int, FrontendId)
END_METADATA
// This represents a suggestion, i.e., a row containing data that will be filled // This represents a suggestion, i.e., a row containing data that will be filled
// into the page if selected. // into the page if selected.
class AutofillPopupSuggestionView : public AutofillPopupItemView { class AutofillPopupSuggestionView : public AutofillPopupItemView {
public: public:
METADATA_HEADER(AutofillPopupSuggestionView);
AutofillPopupSuggestionView(const AutofillPopupSuggestionView&) = delete;
AutofillPopupSuggestionView& operator=(const AutofillPopupSuggestionView&) =
delete;
~AutofillPopupSuggestionView() override = default; ~AutofillPopupSuggestionView() override = default;
static AutofillPopupSuggestionView* Create( static AutofillPopupSuggestionView* Create(
...@@ -320,13 +339,18 @@ class AutofillPopupSuggestionView : public AutofillPopupItemView { ...@@ -320,13 +339,18 @@ class AutofillPopupSuggestionView : public AutofillPopupItemView {
AutofillPopupSuggestionView(AutofillPopupViewNativeViews* popup_view, AutofillPopupSuggestionView(AutofillPopupViewNativeViews* popup_view,
int line_number, int line_number,
int frontend_id); int frontend_id);
DISALLOW_COPY_AND_ASSIGN(AutofillPopupSuggestionView);
}; };
BEGIN_METADATA(AutofillPopupSuggestionView, AutofillPopupItemView)
END_METADATA
// This represents a password suggestion row, i.e., a username and password. // This represents a password suggestion row, i.e., a username and password.
class PasswordPopupSuggestionView : public AutofillPopupSuggestionView { class PasswordPopupSuggestionView : public AutofillPopupSuggestionView {
public: public:
METADATA_HEADER(PasswordPopupSuggestionView);
PasswordPopupSuggestionView(const PasswordPopupSuggestionView&) = delete;
PasswordPopupSuggestionView& operator=(const PasswordPopupSuggestionView&) =
delete;
~PasswordPopupSuggestionView() override = default; ~PasswordPopupSuggestionView() override = default;
static PasswordPopupSuggestionView* Create( static PasswordPopupSuggestionView* Create(
...@@ -347,14 +371,16 @@ class PasswordPopupSuggestionView : public AutofillPopupSuggestionView { ...@@ -347,14 +371,16 @@ class PasswordPopupSuggestionView : public AutofillPopupSuggestionView {
int frontend_id); int frontend_id);
base::string16 origin_; base::string16 origin_;
base::string16 masked_password_; base::string16 masked_password_;
DISALLOW_COPY_AND_ASSIGN(PasswordPopupSuggestionView);
}; };
BEGIN_METADATA(PasswordPopupSuggestionView, AutofillPopupSuggestionView)
END_METADATA
// This represents an option which appears in the footer of the dropdown, such // This represents an option which appears in the footer of the dropdown, such
// as a row which will open the Autofill settings page when selected. // as a row which will open the Autofill settings page when selected.
class AutofillPopupFooterView : public AutofillPopupItemView { class AutofillPopupFooterView : public AutofillPopupItemView {
public: public:
METADATA_HEADER(AutofillPopupFooterView);
~AutofillPopupFooterView() override = default; ~AutofillPopupFooterView() override = default;
static AutofillPopupFooterView* Create( static AutofillPopupFooterView* Create(
...@@ -375,11 +401,18 @@ class AutofillPopupFooterView : public AutofillPopupItemView { ...@@ -375,11 +401,18 @@ class AutofillPopupFooterView : public AutofillPopupItemView {
int frontend_id); int frontend_id);
}; };
BEGIN_METADATA(AutofillPopupFooterView, AutofillPopupItemView)
END_METADATA
// Draws a separator between sections of the dropdown, namely between datalist // Draws a separator between sections of the dropdown, namely between datalist
// and Autofill suggestions. Note that this is NOT the same as the border on top // and Autofill suggestions. Note that this is NOT the same as the border on top
// of the footer section or the border between footer items. // of the footer section or the border between footer items.
class AutofillPopupSeparatorView : public AutofillPopupRowView { class AutofillPopupSeparatorView : public AutofillPopupRowView {
public: public:
METADATA_HEADER(AutofillPopupSeparatorView);
AutofillPopupSeparatorView(const AutofillPopupSeparatorView&) = delete;
AutofillPopupSeparatorView& operator=(const AutofillPopupSeparatorView&) =
delete;
~AutofillPopupSeparatorView() override = default; ~AutofillPopupSeparatorView() override = default;
static AutofillPopupSeparatorView* Create( static AutofillPopupSeparatorView* Create(
...@@ -401,13 +434,17 @@ class AutofillPopupSeparatorView : public AutofillPopupRowView { ...@@ -401,13 +434,17 @@ class AutofillPopupSeparatorView : public AutofillPopupRowView {
private: private:
AutofillPopupSeparatorView(AutofillPopupViewNativeViews* popup_view, AutofillPopupSeparatorView(AutofillPopupViewNativeViews* popup_view,
int line_number); int line_number);
DISALLOW_COPY_AND_ASSIGN(AutofillPopupSeparatorView);
}; };
BEGIN_METADATA(AutofillPopupSeparatorView, AutofillPopupRowView)
END_METADATA
// Draws a row which contains a warning message. // Draws a row which contains a warning message.
class AutofillPopupWarningView : public AutofillPopupRowView { class AutofillPopupWarningView : public AutofillPopupRowView {
public: public:
METADATA_HEADER(AutofillPopupWarningView);
AutofillPopupWarningView(const AutofillPopupWarningView&) = delete;
AutofillPopupWarningView& operator=(const AutofillPopupWarningView&) = delete;
~AutofillPopupWarningView() override = default; ~AutofillPopupWarningView() override = default;
static AutofillPopupWarningView* Create( static AutofillPopupWarningView* Create(
...@@ -429,15 +466,16 @@ class AutofillPopupWarningView : public AutofillPopupRowView { ...@@ -429,15 +466,16 @@ class AutofillPopupWarningView : public AutofillPopupRowView {
AutofillPopupWarningView(AutofillPopupViewNativeViews* popup_view, AutofillPopupWarningView(AutofillPopupViewNativeViews* popup_view,
int line_number) int line_number)
: AutofillPopupRowView(popup_view, line_number) {} : AutofillPopupRowView(popup_view, line_number) {}
DISALLOW_COPY_AND_ASSIGN(AutofillPopupWarningView);
}; };
BEGIN_METADATA(AutofillPopupWarningView, AutofillPopupRowView)
END_METADATA
/************** AutofillPopupItemView **************/ /************** AutofillPopupItemView **************/
void AutofillPopupItemView::GetAccessibleNodeData(ui::AXNodeData* node_data) { void AutofillPopupItemView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
AutofillPopupController* controller = popup_view()->controller(); AutofillPopupController* controller = popup_view()->controller();
auto suggestion = controller->GetSuggestionAt(line_number()); auto suggestion = controller->GetSuggestionAt(GetLineNumber());
std::vector<base::string16> text; std::vector<base::string16> text;
text.push_back(suggestion.value); text.push_back(suggestion.value);
...@@ -461,17 +499,17 @@ void AutofillPopupItemView::GetAccessibleNodeData(ui::AXNodeData* node_data) { ...@@ -461,17 +499,17 @@ void AutofillPopupItemView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
// Options are selectable. // Options are selectable.
node_data->role = ax::mojom::Role::kListBoxOption; node_data->role = ax::mojom::Role::kListBoxOption;
node_data->AddBoolAttribute(ax::mojom::BoolAttribute::kSelected, node_data->AddBoolAttribute(ax::mojom::BoolAttribute::kSelected,
is_selected()); GetSelected());
// Compute set size and position in set, by checking the frontend_id of each // Compute set size and position in set, by checking the frontend_id of each
// row, summing the number of interactive rows, and subtracting the number // row, summing the number of interactive rows, and subtracting the number
// of separators found before this row from its |pos_in_set|. // of separators found before this row from its |pos_in_set|.
int set_size = 0; int set_size = 0;
int pos_in_set = line_number() + 1; int pos_in_set = GetLineNumber() + 1;
for (int i = 0; i < controller->GetLineCount(); ++i) { for (int i = 0; i < controller->GetLineCount(); ++i) {
if (controller->GetSuggestionAt(i).frontend_id == if (controller->GetSuggestionAt(i).frontend_id ==
autofill::POPUP_ITEM_ID_SEPARATOR) { autofill::POPUP_ITEM_ID_SEPARATOR) {
if (i < line_number()) if (i < GetLineNumber())
--pos_in_set; --pos_in_set;
} else { } else {
++set_size; ++set_size;
...@@ -484,7 +522,7 @@ void AutofillPopupItemView::GetAccessibleNodeData(ui::AXNodeData* node_data) { ...@@ -484,7 +522,7 @@ void AutofillPopupItemView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
void AutofillPopupItemView::OnMouseEntered(const ui::MouseEvent& event) { void AutofillPopupItemView::OnMouseEntered(const ui::MouseEvent& event) {
AutofillPopupController* controller = popup_view()->controller(); AutofillPopupController* controller = popup_view()->controller();
if (controller) if (controller)
controller->SetSelectedLine(line_number()); controller->SetSelectedLine(GetLineNumber());
} }
void AutofillPopupItemView::OnMouseExited(const ui::MouseEvent& event) { void AutofillPopupItemView::OnMouseExited(const ui::MouseEvent& event) {
...@@ -497,7 +535,7 @@ void AutofillPopupItemView::OnMouseReleased(const ui::MouseEvent& event) { ...@@ -497,7 +535,7 @@ void AutofillPopupItemView::OnMouseReleased(const ui::MouseEvent& event) {
AutofillPopupController* controller = popup_view()->controller(); AutofillPopupController* controller = popup_view()->controller();
if (controller && event.IsOnlyLeftMouseButton() && if (controller && event.IsOnlyLeftMouseButton() &&
HitTestPoint(event.location())) { HitTestPoint(event.location())) {
controller->AcceptSuggestion(line_number()); controller->AcceptSuggestion(GetLineNumber());
} }
} }
...@@ -507,10 +545,10 @@ void AutofillPopupItemView::OnGestureEvent(ui::GestureEvent* event) { ...@@ -507,10 +545,10 @@ void AutofillPopupItemView::OnGestureEvent(ui::GestureEvent* event) {
return; return;
switch (event->type()) { switch (event->type()) {
case ui::ET_GESTURE_TAP_DOWN: case ui::ET_GESTURE_TAP_DOWN:
controller->SetSelectedLine(line_number()); controller->SetSelectedLine(GetLineNumber());
break; break;
case ui::ET_GESTURE_TAP: case ui::ET_GESTURE_TAP:
controller->AcceptSuggestion(line_number()); controller->AcceptSuggestion(GetLineNumber());
break; break;
case ui::ET_GESTURE_TAP_CANCEL: case ui::ET_GESTURE_TAP_CANCEL:
case ui::ET_GESTURE_END: case ui::ET_GESTURE_END:
...@@ -534,7 +572,7 @@ void AutofillPopupItemView::CreateContent() { ...@@ -534,7 +572,7 @@ void AutofillPopupItemView::CreateContent() {
std::vector<Suggestion> suggestions = controller->GetSuggestions(); std::vector<Suggestion> suggestions = controller->GetSuggestions();
std::unique_ptr<views::ImageView> icon = std::unique_ptr<views::ImageView> icon =
GetIconImageView(suggestions[line_number()]); GetIconImageView(suggestions[GetLineNumber()]);
if (icon) { if (icon) {
AddChildView(std::move(icon)); AddChildView(std::move(icon));
...@@ -570,7 +608,7 @@ void AutofillPopupItemView::CreateContent() { ...@@ -570,7 +608,7 @@ void AutofillPopupItemView::CreateContent() {
AddChildView(std::move(all_labels)); AddChildView(std::move(all_labels));
std::unique_ptr<views::ImageView> store_indicator_icon = std::unique_ptr<views::ImageView> store_indicator_icon =
GetStoreIndicatorIconImageView(suggestions[line_number()]); GetStoreIndicatorIconImageView(suggestions[GetLineNumber()]);
if (store_indicator_icon) { if (store_indicator_icon) {
AddSpacerWithSize(GetHorizontalMargin(), AddSpacerWithSize(GetHorizontalMargin(),
/*resize=*/true, layout_manager); /*resize=*/true, layout_manager);
...@@ -580,9 +618,9 @@ void AutofillPopupItemView::CreateContent() { ...@@ -580,9 +618,9 @@ void AutofillPopupItemView::CreateContent() {
void AutofillPopupItemView::RefreshStyle() { void AutofillPopupItemView::RefreshStyle() {
SetBackground(CreateBackground()); SetBackground(CreateBackground());
SkColor bk_color = is_selected() ? popup_view()->GetSelectedBackgroundColor() SkColor bk_color = GetSelected() ? popup_view()->GetSelectedBackgroundColor()
: popup_view()->GetBackgroundColor(); : popup_view()->GetBackgroundColor();
SkColor fg_color = is_selected() ? popup_view()->GetSelectedForegroundColor() SkColor fg_color = GetSelected() ? popup_view()->GetSelectedForegroundColor()
: popup_view()->GetForegroundColor(); : popup_view()->GetForegroundColor();
for (views::Label* label : inner_labels_) { for (views::Label* label : inner_labels_) {
label->SetAutoColorReadabilityEnabled(false); label->SetAutoColorReadabilityEnabled(false);
...@@ -600,7 +638,7 @@ void AutofillPopupItemView::RefreshStyle() { ...@@ -600,7 +638,7 @@ void AutofillPopupItemView::RefreshStyle() {
std::unique_ptr<views::Background> AutofillPopupItemView::CreateBackground() { std::unique_ptr<views::Background> AutofillPopupItemView::CreateBackground() {
return views::CreateSolidBackground( return views::CreateSolidBackground(
is_selected() ? popup_view()->GetSelectedBackgroundColor() GetSelected() ? popup_view()->GetSelectedBackgroundColor()
: popup_view()->GetBackgroundColor()); : popup_view()->GetBackgroundColor());
} }
...@@ -608,10 +646,10 @@ AutofillPopupItemView::ViewWithLabel AutofillPopupItemView::CreateValueLabel() { ...@@ -608,10 +646,10 @@ AutofillPopupItemView::ViewWithLabel AutofillPopupItemView::CreateValueLabel() {
// TODO(crbug.com/831603): Remove elision responsibilities from controller. // TODO(crbug.com/831603): Remove elision responsibilities from controller.
ViewWithLabel view_and_label; ViewWithLabel view_and_label;
base::string16 text = base::string16 text =
popup_view()->controller()->GetSuggestionValueAt(line_number()); popup_view()->controller()->GetSuggestionValueAt(GetLineNumber());
if (popup_view() if (popup_view()
->controller() ->controller()
->GetSuggestionAt(line_number()) ->GetSuggestionAt(GetLineNumber())
.is_value_secondary) { .is_value_secondary) {
std::unique_ptr<views::Label> label = CreateLabelWithStyleAndContext( std::unique_ptr<views::Label> label = CreateLabelWithStyleAndContext(
text, views::style::CONTEXT_DIALOG_BODY_TEXT, text, views::style::CONTEXT_DIALOG_BODY_TEXT,
...@@ -622,7 +660,7 @@ AutofillPopupItemView::ViewWithLabel AutofillPopupItemView::CreateValueLabel() { ...@@ -622,7 +660,7 @@ AutofillPopupItemView::ViewWithLabel AutofillPopupItemView::CreateValueLabel() {
} }
auto text_label = CreateLabelWithStyleAndContext( auto text_label = CreateLabelWithStyleAndContext(
popup_view()->controller()->GetSuggestionValueAt(line_number()), popup_view()->controller()->GetSuggestionValueAt(GetLineNumber()),
views::style::CONTEXT_DIALOG_BODY_TEXT, GetPrimaryTextStyle()); views::style::CONTEXT_DIALOG_BODY_TEXT, GetPrimaryTextStyle());
const gfx::Font::Weight font_weight = GetPrimaryTextWeight(); const gfx::Font::Weight font_weight = GetPrimaryTextWeight();
...@@ -708,9 +746,9 @@ AutofillPopupSuggestionView::AutofillPopupSuggestionView( ...@@ -708,9 +746,9 @@ AutofillPopupSuggestionView::AutofillPopupSuggestionView(
std::vector<AutofillPopupItemView::ViewWithLabel> std::vector<AutofillPopupItemView::ViewWithLabel>
AutofillPopupSuggestionView::CreateSubtextLabels() { AutofillPopupSuggestionView::CreateSubtextLabels() {
const base::string16& second_row_label = const base::string16& second_row_label =
popup_view()->controller()->GetSuggestionAt(line_number()).label; popup_view()->controller()->GetSuggestionAt(GetLineNumber()).label;
const base::string16& third_row_label = const base::string16& third_row_label =
popup_view()->controller()->GetSuggestionAt(line_number()).offer_label; popup_view()->controller()->GetSuggestionAt(GetLineNumber()).offer_label;
std::vector<AutofillPopupItemView::ViewWithLabel> labels; std::vector<AutofillPopupItemView::ViewWithLabel> labels;
for (const base::string16& text : {second_row_label, third_row_label}) { for (const base::string16& text : {second_row_label, third_row_label}) {
...@@ -819,11 +857,11 @@ void AutofillPopupFooterView::CreateContent() { ...@@ -819,11 +857,11 @@ void AutofillPopupFooterView::CreateContent() {
layout_manager->set_cross_axis_alignment( layout_manager->set_cross_axis_alignment(
views::BoxLayout::CrossAxisAlignment::kCenter); views::BoxLayout::CrossAxisAlignment::kCenter);
const Suggestion suggestion = controller->GetSuggestions()[line_number()]; const Suggestion suggestion = controller->GetSuggestions()[GetLineNumber()];
std::unique_ptr<views::ImageView> icon = GetIconImageView(suggestion); std::unique_ptr<views::ImageView> icon = GetIconImageView(suggestion);
const bool use_leading_icon = const bool use_leading_icon =
base::Contains(kItemTypesUsingLeadingIcons, frontend_id()); base::Contains(kItemTypesUsingLeadingIcons, GetFrontendId());
if (suggestion.is_loading) { if (suggestion.is_loading) {
SetEnabled(false); SetEnabled(false);
...@@ -949,7 +987,7 @@ void AutofillPopupWarningView::GetAccessibleNodeData( ...@@ -949,7 +987,7 @@ void AutofillPopupWarningView::GetAccessibleNodeData(
if (!controller) if (!controller)
return; return;
node_data->SetName(controller->GetSuggestionAt(line_number()).value); node_data->SetName(controller->GetSuggestionAt(GetLineNumber()).value);
node_data->role = ax::mojom::Role::kStaticText; node_data->role = ax::mojom::Role::kStaticText;
} }
...@@ -964,7 +1002,7 @@ void AutofillPopupWarningView::CreateContent() { ...@@ -964,7 +1002,7 @@ void AutofillPopupWarningView::CreateContent() {
gfx::Insets(vertical_margin, horizontal_margin))); gfx::Insets(vertical_margin, horizontal_margin)));
auto text_label = std::make_unique<views::Label>( auto text_label = std::make_unique<views::Label>(
controller->GetSuggestionValueAt(line_number()), controller->GetSuggestionValueAt(GetLineNumber()),
views::style::CONTEXT_DIALOG_BODY_TEXT, ChromeTextStyle::STYLE_RED); views::style::CONTEXT_DIALOG_BODY_TEXT, ChromeTextStyle::STYLE_RED);
text_label->SetEnabledColor(popup_view()->GetWarningColor()); text_label->SetEnabledColor(popup_view()->GetWarningColor());
text_label->SetMultiLine(true); text_label->SetMultiLine(true);
...@@ -982,14 +1020,15 @@ AutofillPopupWarningView::CreateBackground() { ...@@ -982,14 +1020,15 @@ AutofillPopupWarningView::CreateBackground() {
/************** AutofillPopupRowView **************/ /************** AutofillPopupRowView **************/
void AutofillPopupRowView::SetSelected(bool is_selected) { void AutofillPopupRowView::SetSelected(bool selected) {
if (is_selected == is_selected_) if (selected == selected_)
return; return;
is_selected_ = is_selected; selected_ = selected;
if (is_selected) if (selected)
popup_view_->NotifyAXSelection(this); popup_view_->NotifyAXSelection(this);
RefreshStyle(); RefreshStyle();
OnPropertyChanged(&selected_, views::kPropertyEffectsNone);
} }
void AutofillPopupRowView::OnThemeChanged() { void AutofillPopupRowView::OnThemeChanged() {
...@@ -1016,6 +1055,14 @@ void AutofillPopupRowView::Init() { ...@@ -1016,6 +1055,14 @@ void AutofillPopupRowView::Init() {
CreateContent(); CreateContent();
} }
int AutofillPopupRowView::GetLineNumber() const {
return line_number_;
}
bool AutofillPopupRowView::GetSelected() const {
return selected_;
}
bool AutofillPopupRowView::HandleAccessibleAction( bool AutofillPopupRowView::HandleAccessibleAction(
const ui::AXActionData& action_data) { const ui::AXActionData& action_data) {
if (action_data.action == ax::mojom::Action::kFocus) if (action_data.action == ax::mojom::Action::kFocus)
...@@ -1023,6 +1070,11 @@ bool AutofillPopupRowView::HandleAccessibleAction( ...@@ -1023,6 +1070,11 @@ bool AutofillPopupRowView::HandleAccessibleAction(
return View::HandleAccessibleAction(action_data); return View::HandleAccessibleAction(action_data);
} }
BEGIN_METADATA(AutofillPopupRowView, views::View)
ADD_PROPERTY_METADATA(bool, Selected)
ADD_READONLY_PROPERTY_METADATA(int, LineNumber)
END_METADATA
/************** AutofillPopupViewNativeViews **************/ /************** AutofillPopupViewNativeViews **************/
AutofillPopupViewNativeViews::AutofillPopupViewNativeViews( AutofillPopupViewNativeViews::AutofillPopupViewNativeViews(
...@@ -1306,6 +1358,9 @@ bool AutofillPopupViewNativeViews::DoUpdateBoundsAndRedrawPopup() { ...@@ -1306,6 +1358,9 @@ bool AutofillPopupViewNativeViews::DoUpdateBoundsAndRedrawPopup() {
return true; return true;
} }
BEGIN_METADATA(AutofillPopupViewNativeViews, AutofillPopupBaseView)
END_METADATA
// static // static
AutofillPopupView* AutofillPopupView::Create( AutofillPopupView* AutofillPopupView::Create(
base::WeakPtr<AutofillPopupController> controller) { base::WeakPtr<AutofillPopupController> controller) {
......
...@@ -8,13 +8,13 @@ ...@@ -8,13 +8,13 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "base/macros.h"
#include "base/optional.h" #include "base/optional.h"
#include "chrome/browser/ui/autofill/autofill_popup_view.h" #include "chrome/browser/ui/autofill/autofill_popup_view.h"
#include "chrome/browser/ui/views/autofill/autofill_popup_base_view.h" #include "chrome/browser/ui/views/autofill/autofill_popup_base_view.h"
#include "ui/accessibility/ax_action_data.h" #include "ui/accessibility/ax_action_data.h"
#include "ui/gfx/color_palette.h" #include "ui/gfx/color_palette.h"
#include "ui/gfx/font_list.h" #include "ui/gfx/font_list.h"
#include "ui/views/metadata/metadata_header_macros.h"
namespace views { namespace views {
class BoxLayout; class BoxLayout;
...@@ -30,8 +30,11 @@ class AutofillPopupViewNativeViews; ...@@ -30,8 +30,11 @@ class AutofillPopupViewNativeViews;
// separators. // separators.
class AutofillPopupRowView : public views::View { class AutofillPopupRowView : public views::View {
public: public:
METADATA_HEADER(AutofillPopupRowView);
AutofillPopupRowView(const AutofillPopupRowView&) = delete;
AutofillPopupRowView& operator=(const AutofillPopupRowView&) = delete;
~AutofillPopupRowView() override = default; ~AutofillPopupRowView() override = default;
void SetSelected(bool is_selected); void SetSelected(bool selected);
// views::View: // views::View:
bool HandleAccessibleAction(const ui::AXActionData& action_data) override; bool HandleAccessibleAction(const ui::AXActionData& action_data) override;
...@@ -52,8 +55,8 @@ class AutofillPopupRowView : public views::View { ...@@ -52,8 +55,8 @@ class AutofillPopupRowView : public views::View {
void Init(); void Init();
AutofillPopupViewNativeViews* popup_view() { return popup_view_; } AutofillPopupViewNativeViews* popup_view() { return popup_view_; }
int line_number() const { return line_number_; } int GetLineNumber() const;
bool is_selected() const { return is_selected_; } bool GetSelected() const;
virtual void CreateContent() = 0; virtual void CreateContent() = 0;
virtual void RefreshStyle() = 0; virtual void RefreshStyle() = 0;
...@@ -62,9 +65,7 @@ class AutofillPopupRowView : public views::View { ...@@ -62,9 +65,7 @@ class AutofillPopupRowView : public views::View {
private: private:
AutofillPopupViewNativeViews* popup_view_; AutofillPopupViewNativeViews* popup_view_;
const int line_number_; const int line_number_;
bool is_selected_ = false; bool selected_ = false;
DISALLOW_COPY_AND_ASSIGN(AutofillPopupRowView);
}; };
// Views implementation for the autofill and password suggestion. // Views implementation for the autofill and password suggestion.
...@@ -72,8 +73,12 @@ class AutofillPopupRowView : public views::View { ...@@ -72,8 +73,12 @@ class AutofillPopupRowView : public views::View {
class AutofillPopupViewNativeViews : public AutofillPopupBaseView, class AutofillPopupViewNativeViews : public AutofillPopupBaseView,
public AutofillPopupView { public AutofillPopupView {
public: public:
METADATA_HEADER(AutofillPopupViewNativeViews);
AutofillPopupViewNativeViews(AutofillPopupController* controller, AutofillPopupViewNativeViews(AutofillPopupController* controller,
views::Widget* parent_widget); views::Widget* parent_widget);
AutofillPopupViewNativeViews(const AutofillPopupViewNativeViews&) = delete;
AutofillPopupViewNativeViews& operator=(const AutofillPopupViewNativeViews&) =
delete;
~AutofillPopupViewNativeViews() override; ~AutofillPopupViewNativeViews() override;
const std::vector<AutofillPopupRowView*>& GetRowsForTesting() { const std::vector<AutofillPopupRowView*>& GetRowsForTesting() {
...@@ -118,8 +123,6 @@ class AutofillPopupViewNativeViews : public AutofillPopupBaseView, ...@@ -118,8 +123,6 @@ class AutofillPopupViewNativeViews : public AutofillPopupBaseView,
views::ScrollView* scroll_view_ = nullptr; views::ScrollView* scroll_view_ = nullptr;
views::View* body_container_ = nullptr; views::View* body_container_ = nullptr;
views::View* footer_container_ = nullptr; views::View* footer_container_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(AutofillPopupViewNativeViews);
}; };
} // namespace autofill } // namespace autofill
......
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
#include "ui/views/layout/box_layout.h" #include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h" #include "ui/views/layout/fill_layout.h"
#include "ui/views/layout/grid_layout.h" #include "ui/views/layout/grid_layout.h"
#include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/metadata/metadata_impl_macros.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
namespace { namespace {
...@@ -171,6 +173,7 @@ bool CookiesTreeViewDrawingProvider::ShouldDrawIconForNode( ...@@ -171,6 +173,7 @@ bool CookiesTreeViewDrawingProvider::ShouldDrawIconForNode(
// A custom view that conditionally displays an infobar. // A custom view that conditionally displays an infobar.
class InfobarView : public views::View { class InfobarView : public views::View {
public: public:
METADATA_HEADER(InfobarView);
InfobarView() { InfobarView() {
info_image_ = AddChildView(std::make_unique<views::ImageView>()); info_image_ = AddChildView(std::make_unique<views::ImageView>());
info_image_->SetImage(gfx::CreateVectorIcon(vector_icons::kInfoOutlineIcon, info_image_->SetImage(gfx::CreateVectorIcon(vector_icons::kInfoOutlineIcon,
...@@ -196,7 +199,9 @@ class InfobarView : public views::View { ...@@ -196,7 +199,9 @@ class InfobarView : public views::View {
horizontal_spacing)); horizontal_spacing));
SetVisible(false); SetVisible(false);
} }
~InfobarView() override {} InfobarView(const InfobarView&) = delete;
InfobarView& operator=(const InfobarView&) = delete;
~InfobarView() override = default;
// Set the InfobarView label text based on content |setting| and // Set the InfobarView label text based on content |setting| and
// |domain_name|. Ensure InfobarView is visible. // |domain_name|. Ensure InfobarView is visible.
...@@ -230,10 +235,11 @@ class InfobarView : public views::View { ...@@ -230,10 +235,11 @@ class InfobarView : public views::View {
views::ImageView* info_image_; views::ImageView* info_image_;
// The label responsible for rendering the text. // The label responsible for rendering the text.
views::Label* label_; views::Label* label_;
DISALLOW_COPY_AND_ASSIGN(InfobarView);
}; };
BEGIN_METADATA(InfobarView, views::View)
END_METADATA
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// CollectedCookiesViews, public: // CollectedCookiesViews, public:
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "ui/views/controls/throbber.h" #include "ui/views/controls/throbber.h"
#include "ui/views/layout/box_layout.h" #include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h" #include "ui/views/layout/fill_layout.h"
#include "ui/views/metadata/metadata_impl_macros.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
DeviceChooserContentView::DeviceChooserContentView( DeviceChooserContentView::DeviceChooserContentView(
...@@ -379,3 +380,7 @@ views::Throbber* DeviceChooserContentView::ThrobberForTesting() { ...@@ -379,3 +380,7 @@ views::Throbber* DeviceChooserContentView::ThrobberForTesting() {
views::Label* DeviceChooserContentView::ThrobberLabelForTesting() { views::Label* DeviceChooserContentView::ThrobberLabelForTesting() {
return throbber_label_; return throbber_label_;
} }
BEGIN_METADATA(DeviceChooserContentView, views::View)
ADD_READONLY_PROPERTY_METADATA(base::string16, WindowTitle)
END_METADATA
...@@ -7,11 +7,11 @@ ...@@ -7,11 +7,11 @@
#include <memory> #include <memory>
#include "base/macros.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "chrome/browser/chooser_controller/chooser_controller.h" #include "chrome/browser/chooser_controller/chooser_controller.h"
#include "ui/base/models/table_model.h" #include "ui/base/models/table_model.h"
#include "ui/gfx/range/range.h" #include "ui/gfx/range/range.h"
#include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/view.h" #include "ui/views/view.h"
namespace views { namespace views {
...@@ -29,9 +29,12 @@ class DeviceChooserContentView : public views::View, ...@@ -29,9 +29,12 @@ class DeviceChooserContentView : public views::View,
public ui::TableModel, public ui::TableModel,
public ChooserController::View { public ChooserController::View {
public: public:
METADATA_HEADER(DeviceChooserContentView);
DeviceChooserContentView( DeviceChooserContentView(
views::TableViewObserver* table_view_observer, views::TableViewObserver* table_view_observer,
std::unique_ptr<ChooserController> chooser_controller); std::unique_ptr<ChooserController> chooser_controller);
DeviceChooserContentView(const DeviceChooserContentView&) = delete;
DeviceChooserContentView& operator=(const DeviceChooserContentView&) = delete;
~DeviceChooserContentView() override; ~DeviceChooserContentView() override;
// views::View: // views::View:
...@@ -91,8 +94,6 @@ class DeviceChooserContentView : public views::View, ...@@ -91,8 +94,6 @@ class DeviceChooserContentView : public views::View,
bool is_initialized_ = false; bool is_initialized_ = false;
base::CallbackListSubscription select_all_subscription_; base::CallbackListSubscription select_all_subscription_;
DISALLOW_COPY_AND_ASSIGN(DeviceChooserContentView);
}; };
#endif // CHROME_BROWSER_UI_VIEWS_DEVICE_CHOOSER_CONTENT_VIEW_H_ #endif // CHROME_BROWSER_UI_VIEWS_DEVICE_CHOOSER_CONTENT_VIEW_H_
...@@ -199,6 +199,8 @@ ...@@ -199,6 +199,8 @@
#include "ui/views/controls/webview/webview.h" #include "ui/views/controls/webview/webview.h"
#include "ui/views/focus/external_focus_tracker.h" #include "ui/views/focus/external_focus_tracker.h"
#include "ui/views/layout/grid_layout.h" #include "ui/views/layout/grid_layout.h"
#include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/metadata/metadata_impl_macros.h"
#include "ui/views/view_class_properties.h" #include "ui/views/view_class_properties.h"
#include "ui/views/widget/native_widget.h" #include "ui/views/widget/native_widget.h"
#include "ui/views/widget/root_view.h" #include "ui/views/widget/root_view.h"
...@@ -348,6 +350,7 @@ bool IsShowingWebContentsModalDialog(content::WebContents* web_contents) { ...@@ -348,6 +350,7 @@ bool IsShowingWebContentsModalDialog(content::WebContents* web_contents) {
// immersive fullscreen reveal). // immersive fullscreen reveal).
class TopContainerOverlayView : public views::View { class TopContainerOverlayView : public views::View {
public: public:
METADATA_HEADER(TopContainerOverlayView);
explicit TopContainerOverlayView(base::WeakPtr<BrowserView> browser_view) explicit TopContainerOverlayView(base::WeakPtr<BrowserView> browser_view)
: browser_view_(std::move(browser_view)) {} : browser_view_(std::move(browser_view)) {}
~TopContainerOverlayView() override = default; ~TopContainerOverlayView() override = default;
...@@ -370,6 +373,9 @@ class TopContainerOverlayView : public views::View { ...@@ -370,6 +373,9 @@ class TopContainerOverlayView : public views::View {
base::WeakPtr<BrowserView> browser_view_; base::WeakPtr<BrowserView> browser_view_;
}; };
BEGIN_METADATA(TopContainerOverlayView, views::View)
END_METADATA
// A view targeter for the overlay view, which makes sure the overlay view // A view targeter for the overlay view, which makes sure the overlay view
// itself is never a target for events, but its children (i.e. top_container) // itself is never a target for events, but its children (i.e. top_container)
// may be. // may be.
...@@ -394,6 +400,9 @@ class OverlayViewTargeterDelegate : public views::ViewTargeterDelegate { ...@@ -394,6 +400,9 @@ class OverlayViewTargeterDelegate : public views::ViewTargeterDelegate {
}; };
class ContentsSeparator : public views::Separator { class ContentsSeparator : public views::Separator {
public:
METADATA_HEADER(ContentsSeparator);
private: private:
// views::View: // views::View:
void OnThemeChanged() override { void OnThemeChanged() override {
...@@ -411,6 +420,9 @@ class ContentsSeparator : public views::Separator { ...@@ -411,6 +420,9 @@ class ContentsSeparator : public views::Separator {
} }
}; };
BEGIN_METADATA(ContentsSeparator, views::Separator)
END_METADATA
bool ShouldShowWindowIcon(const Browser* browser) { bool ShouldShowWindowIcon(const Browser* browser) {
#if BUILDFLAG(IS_CHROMEOS_ASH) #if BUILDFLAG(IS_CHROMEOS_ASH)
// For Chrome OS only, trusted windows (apps and settings) do not show a // For Chrome OS only, trusted windows (apps and settings) do not show a
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include "ui/views/controls/label.h" #include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h" #include "ui/views/layout/box_layout.h"
#include "ui/views/layout/grid_layout.h" #include "ui/views/layout/grid_layout.h"
#include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/metadata/metadata_impl_macros.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
namespace { namespace {
...@@ -39,6 +41,7 @@ constexpr int kPasswordGenerationMaxWidth = 480; ...@@ -39,6 +41,7 @@ constexpr int kPasswordGenerationMaxWidth = 480;
class PasswordGenerationPopupViewViews::GeneratedPasswordBox class PasswordGenerationPopupViewViews::GeneratedPasswordBox
: public views::View { : public views::View {
public: public:
METADATA_HEADER(GeneratedPasswordBox);
GeneratedPasswordBox() = default; GeneratedPasswordBox() = default;
~GeneratedPasswordBox() override = default; ~GeneratedPasswordBox() override = default;
...@@ -155,6 +158,11 @@ void PasswordGenerationPopupViewViews::GeneratedPasswordBox::BuildColumnSet( ...@@ -155,6 +158,11 @@ void PasswordGenerationPopupViewViews::GeneratedPasswordBox::BuildColumnSet(
views::GridLayout::ColumnSize::kUsePreferred, 0, 0); views::GridLayout::ColumnSize::kUsePreferred, 0, 0);
} }
BEGIN_NESTED_METADATA(PasswordGenerationPopupViewViews,
GeneratedPasswordBox,
views::View)
END_METADATA
PasswordGenerationPopupViewViews::PasswordGenerationPopupViewViews( PasswordGenerationPopupViewViews::PasswordGenerationPopupViewViews(
PasswordGenerationPopupController* controller, PasswordGenerationPopupController* controller,
views::Widget* parent_widget) views::Widget* parent_widget)
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include "ui/views/bubble/bubble_border.h" #include "ui/views/bubble/bubble_border.h"
#include "ui/views/controls/label.h" #include "ui/views/controls/label.h"
#include "ui/views/layout/box_layout.h" #include "ui/views/layout/box_layout.h"
#include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/metadata/metadata_impl_macros.h"
#include "ui/views/style/typography.h" #include "ui/views/style/typography.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
...@@ -52,13 +54,16 @@ const char kKeyNameDelimiter[] = "|"; ...@@ -52,13 +54,16 @@ const char kKeyNameDelimiter[] = "|";
// key (not just a simple label). // key (not just a simple label).
class SubtleNotificationView::InstructionView : public views::View { class SubtleNotificationView::InstructionView : public views::View {
public: public:
METADATA_HEADER(InstructionView);
// Creates an InstructionView with specific text. |text| may contain one or // Creates an InstructionView with specific text. |text| may contain one or
// more segments delimited by a pair of pipes ('|'); each of these segments // more segments delimited by a pair of pipes ('|'); each of these segments
// will be displayed as a keyboard key. e.g., "Press |Alt|+|Q| to exit" will // will be displayed as a keyboard key. e.g., "Press |Alt|+|Q| to exit" will
// have "Alt" and "Q" rendered as keys. // have "Alt" and "Q" rendered as keys.
explicit InstructionView(const base::string16& text); explicit InstructionView(const base::string16& text);
InstructionView(const InstructionView&) = delete;
InstructionView& operator=(const InstructionView&) = delete;
const base::string16 text() const { return text_; } base::string16 GetText() const;
void SetText(const base::string16& text); void SetText(const base::string16& text);
private: private:
...@@ -68,8 +73,6 @@ class SubtleNotificationView::InstructionView : public views::View { ...@@ -68,8 +73,6 @@ class SubtleNotificationView::InstructionView : public views::View {
void AddTextSegment(const base::string16& text, bool format_as_key); void AddTextSegment(const base::string16& text, bool format_as_key);
base::string16 text_; base::string16 text_;
DISALLOW_COPY_AND_ASSIGN(InstructionView);
}; };
SubtleNotificationView::InstructionView::InstructionView( SubtleNotificationView::InstructionView::InstructionView(
...@@ -82,6 +85,10 @@ SubtleNotificationView::InstructionView::InstructionView( ...@@ -82,6 +85,10 @@ SubtleNotificationView::InstructionView::InstructionView(
SetText(text); SetText(text);
} }
base::string16 SubtleNotificationView::InstructionView::GetText() const {
return text_;
}
void SubtleNotificationView::InstructionView::SetText( void SubtleNotificationView::InstructionView::SetText(
const base::string16& text) { const base::string16& text) {
// Avoid replacing the contents with the same text. // Avoid replacing the contents with the same text.
...@@ -139,6 +146,10 @@ void SubtleNotificationView::InstructionView::AddTextSegment( ...@@ -139,6 +146,10 @@ void SubtleNotificationView::InstructionView::AddTextSegment(
AddChildView(key); AddChildView(key);
} }
BEGIN_NESTED_METADATA(SubtleNotificationView, InstructionView, views::View)
ADD_PROPERTY_METADATA(base::string16, Text)
END_METADATA
SubtleNotificationView::SubtleNotificationView() : instruction_view_(nullptr) { SubtleNotificationView::SubtleNotificationView() : instruction_view_(nullptr) {
std::unique_ptr<views::BubbleBorder> bubble_border(new views::BubbleBorder( std::unique_ptr<views::BubbleBorder> bubble_border(new views::BubbleBorder(
views::BubbleBorder::NONE, views::BubbleBorder::NO_SHADOW, views::BubbleBorder::NONE, views::BubbleBorder::NO_SHADOW,
...@@ -193,7 +204,10 @@ views::Widget* SubtleNotificationView::CreatePopupWidget( ...@@ -193,7 +204,10 @@ views::Widget* SubtleNotificationView::CreatePopupWidget(
void SubtleNotificationView::GetAccessibleNodeData(ui::AXNodeData* node_data) { void SubtleNotificationView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
node_data->role = ax::mojom::Role::kAlert; node_data->role = ax::mojom::Role::kAlert;
base::string16 accessible_name; base::string16 accessible_name;
base::RemoveChars(instruction_view_->text(), base::RemoveChars(instruction_view_->GetText(),
base::ASCIIToUTF16(kKeyNameDelimiter), &accessible_name); base::ASCIIToUTF16(kKeyNameDelimiter), &accessible_name);
node_data->SetName(accessible_name); node_data->SetName(accessible_name);
} }
BEGIN_METADATA(SubtleNotificationView, views::View)
END_METADATA
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
#include <memory> #include <memory>
#include "base/macros.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
#include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/view.h" #include "ui/views/view.h"
namespace views { namespace views {
...@@ -24,7 +24,10 @@ class Widget; ...@@ -24,7 +24,10 @@ class Widget;
// rounded rectangle). // rounded rectangle).
class SubtleNotificationView : public views::View { class SubtleNotificationView : public views::View {
public: public:
METADATA_HEADER(SubtleNotificationView);
SubtleNotificationView(); SubtleNotificationView();
SubtleNotificationView(const SubtleNotificationView&) = delete;
SubtleNotificationView& operator=(const SubtleNotificationView&) = delete;
~SubtleNotificationView() override; ~SubtleNotificationView() override;
// Display the |instruction_text| to the user. If |instruction_text| is // Display the |instruction_text| to the user. If |instruction_text| is
...@@ -43,8 +46,6 @@ class SubtleNotificationView : public views::View { ...@@ -43,8 +46,6 @@ class SubtleNotificationView : public views::View {
// Text displayed in the bubble, with optional keyboard keys. // Text displayed in the bubble, with optional keyboard keys.
InstructionView* instruction_view_; InstructionView* instruction_view_;
DISALLOW_COPY_AND_ASSIGN(SubtleNotificationView);
}; };
#endif // CHROME_BROWSER_UI_VIEWS_SUBTLE_NOTIFICATION_VIEW_H_ #endif // CHROME_BROWSER_UI_VIEWS_SUBTLE_NOTIFICATION_VIEW_H_
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "ui/views/layout/box_layout.h" #include "ui/views/layout/box_layout.h"
#include "ui/views/layout/flex_layout.h" #include "ui/views/layout/flex_layout.h"
#include "ui/views/layout/flex_layout_types.h" #include "ui/views/layout/flex_layout_types.h"
#include "ui/views/metadata/metadata_impl_macros.h"
#include "ui/views/view_class_properties.h" #include "ui/views/view_class_properties.h"
namespace { namespace {
...@@ -279,3 +280,7 @@ void ColorPickerView::OnColorSelected(ColorPickerElementView* element) { ...@@ -279,3 +280,7 @@ void ColorPickerView::OnColorSelected(ColorPickerElementView* element) {
if (callback_) if (callback_)
callback_.Run(); callback_.Run();
} }
BEGIN_METADATA(ColorPickerView, views::View)
ADD_READONLY_PROPERTY_METADATA(base::Optional<int>, SelectedElement)
END_METADATA
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "chrome/browser/ui/views/tabs/tab_group_editor_bubble_view.h" #include "chrome/browser/ui/views/tabs/tab_group_editor_bubble_view.h"
#include "components/tab_groups/tab_group_color.h" #include "components/tab_groups/tab_group_color.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/view.h" #include "ui/views/view.h"
namespace views { namespace views {
...@@ -28,6 +29,8 @@ class ColorPickerElementView; ...@@ -28,6 +29,8 @@ class ColorPickerElementView;
// selection is made. // selection is made.
class ColorPickerView : public views::View { class ColorPickerView : public views::View {
public: public:
METADATA_HEADER(ColorPickerView);
using ColorSelectedCallback = base::RepeatingCallback<void()>; using ColorSelectedCallback = base::RepeatingCallback<void()>;
// |colors| should contain the color values and accessible names. There should // |colors| should contain the color values and accessible names. There should
......
...@@ -67,6 +67,8 @@ ...@@ -67,6 +67,8 @@
#include "ui/views/layout/flex_layout.h" #include "ui/views/layout/flex_layout.h"
#include "ui/views/layout/flex_layout_types.h" #include "ui/views/layout/flex_layout_types.h"
#include "ui/views/layout/grid_layout.h" #include "ui/views/layout/grid_layout.h"
#include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/metadata/metadata_impl_macros.h"
#include "ui/views/style/platform_style.h" #include "ui/views/style/platform_style.h"
#include "ui/views/view_class_properties.h" #include "ui/views/view_class_properties.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
...@@ -77,14 +79,17 @@ namespace { ...@@ -77,14 +79,17 @@ namespace {
// button changes a layout is required. // button changes a layout is required.
class AdvancedViewContainer : public views::View { class AdvancedViewContainer : public views::View {
public: public:
METADATA_HEADER(AdvancedViewContainer);
AdvancedViewContainer() {} AdvancedViewContainer() {}
AdvancedViewContainer(const AdvancedViewContainer&) = delete;
AdvancedViewContainer& operator=(const AdvancedViewContainer&) = delete;
void ChildPreferredSizeChanged(views::View* child) override { Layout(); } void ChildPreferredSizeChanged(views::View* child) override { Layout(); }
private:
DISALLOW_COPY_AND_ASSIGN(AdvancedViewContainer);
}; };
BEGIN_METADATA(AdvancedViewContainer, views::View)
END_METADATA
bool UseGoogleTranslateBranding() { bool UseGoogleTranslateBranding() {
// Only use Google Translate branding in Chrome branded builds. // Only use Google Translate branding in Chrome branded builds.
#if BUILDFLAG(GOOGLE_CHROME_BRANDING) #if BUILDFLAG(GOOGLE_CHROME_BRANDING)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment