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

Add metadata for misc. files in c/b/ui/views.

Bug: 1159562
Change-Id: Ib43a3205a0c553e97693e63ecc8838edaa540a9a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2628020
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843627}
parent 488d85a1
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "content/public/browser/render_process_host.h" #include "content/public/browser/render_process_host.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/views/metadata/metadata_impl_macros.h"
FileSystemAccessIconView::FileSystemAccessIconView( FileSystemAccessIconView::FileSystemAccessIconView(
IconLabelBubbleView::Delegate* icon_label_bubble_delegate, IconLabelBubbleView::Delegate* icon_label_bubble_delegate,
...@@ -97,6 +98,5 @@ const gfx::VectorIcon& FileSystemAccessIconView::GetVectorIcon() const { ...@@ -97,6 +98,5 @@ const gfx::VectorIcon& FileSystemAccessIconView::GetVectorIcon() const {
: vector_icons::kInsertDriveFileOutlineIcon; : vector_icons::kInsertDriveFileOutlineIcon;
} }
const char* FileSystemAccessIconView::GetClassName() const { BEGIN_METADATA(FileSystemAccessIconView, PageActionIconView)
return "FileSystemAccessIconView"; END_METADATA
}
...@@ -6,15 +6,19 @@ ...@@ -6,15 +6,19 @@
#define CHROME_BROWSER_UI_VIEWS_FILE_SYSTEM_ACCESS_FILE_SYSTEM_ACCESS_ICON_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_FILE_SYSTEM_ACCESS_FILE_SYSTEM_ACCESS_ICON_VIEW_H_
#include "chrome/browser/ui/views/page_action/page_action_icon_view.h" #include "chrome/browser/ui/views/page_action/page_action_icon_view.h"
#include "ui/views/metadata/metadata_header_macros.h"
// Page action icon indicating if the current page is using the File System // Page action icon indicating if the current page is using the File System
// Access API. Shows different icons for read access to directories and write // Access API. Shows different icons for read access to directories and write
// access to files or directories. // access to files or directories.
class FileSystemAccessIconView : public PageActionIconView { class FileSystemAccessIconView : public PageActionIconView {
public: public:
METADATA_HEADER(FileSystemAccessIconView);
FileSystemAccessIconView( FileSystemAccessIconView(
IconLabelBubbleView::Delegate* icon_label_bubble_delegate, IconLabelBubbleView::Delegate* icon_label_bubble_delegate,
PageActionIconView::Delegate* page_action_icon_delegate); PageActionIconView::Delegate* page_action_icon_delegate);
FileSystemAccessIconView(const FileSystemAccessIconView&) = delete;
FileSystemAccessIconView& operator=(const FileSystemAccessIconView&) = delete;
// PageActionIconView: // PageActionIconView:
views::BubbleDialogDelegate* GetBubble() const override; views::BubbleDialogDelegate* GetBubble() const override;
...@@ -22,12 +26,9 @@ class FileSystemAccessIconView : public PageActionIconView { ...@@ -22,12 +26,9 @@ class FileSystemAccessIconView : public PageActionIconView {
base::string16 GetTextForTooltipAndAccessibleName() const override; base::string16 GetTextForTooltipAndAccessibleName() const override;
void OnExecuting(ExecuteSource execute_source) override; void OnExecuting(ExecuteSource execute_source) override;
const gfx::VectorIcon& GetVectorIcon() const override; const gfx::VectorIcon& GetVectorIcon() const override;
const char* GetClassName() const override;
private: private:
bool has_write_access_ = false; bool has_write_access_ = false;
DISALLOW_COPY_AND_ASSIGN(FileSystemAccessIconView);
}; };
#endif // CHROME_BROWSER_UI_VIEWS_FILE_SYSTEM_ACCESS_FILE_SYSTEM_ACCESS_ICON_VIEW_H_ #endif // CHROME_BROWSER_UI_VIEWS_FILE_SYSTEM_ACCESS_FILE_SYSTEM_ACCESS_ICON_VIEW_H_
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/events/event_utils.h" #include "ui/events/event_utils.h"
#include "ui/views/layout/animating_layout_manager_test_util.h" #include "ui/views/layout/animating_layout_manager_test_util.h"
#include "ui/views/view_utils.h"
// The param indicates if the feature showing password icon in the new toolbar // The param indicates if the feature showing password icon in the new toolbar
// status chip is enabled. // status chip is enabled.
...@@ -53,7 +54,7 @@ class ManagePasswordsIconViewTest : public ManagePasswordsTest, ...@@ -53,7 +54,7 @@ class ManagePasswordsIconViewTest : public ManagePasswordsTest,
BrowserView::GetBrowserViewForBrowser(browser()) BrowserView::GetBrowserViewForBrowser(browser())
->toolbar_button_provider() ->toolbar_button_provider()
->GetPageActionIconView(PageActionIconType::kManagePasswords); ->GetPageActionIconView(PageActionIconType::kManagePasswords);
DCHECK_EQ(view->GetClassName(), ManagePasswordsIconViews::kClassName); DCHECK(views::IsViewClass<ManagePasswordsIconViews>(view));
return static_cast<ManagePasswordsIconViews*>(view); return static_cast<ManagePasswordsIconViews*>(view);
} }
......
...@@ -13,8 +13,7 @@ ...@@ -13,8 +13,7 @@
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/views/metadata/metadata_impl_macros.h"
const char ManagePasswordsIconViews::kClassName[] = "ManagePasswordsIconViews";
ManagePasswordsIconViews::ManagePasswordsIconViews( ManagePasswordsIconViews::ManagePasswordsIconViews(
CommandUpdater* updater, CommandUpdater* updater,
...@@ -108,6 +107,5 @@ void ManagePasswordsIconViews::AboutToRequestFocusFromTabTraversal( ...@@ -108,6 +107,5 @@ void ManagePasswordsIconViews::AboutToRequestFocusFromTabTraversal(
PasswordBubbleViewBase::ActivateBubble(); PasswordBubbleViewBase::ActivateBubble();
} }
const char* ManagePasswordsIconViews::GetClassName() const { BEGIN_METADATA(ManagePasswordsIconViews, PageActionIconView)
return kClassName; END_METADATA
}
...@@ -5,11 +5,11 @@ ...@@ -5,11 +5,11 @@
#ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_ICON_VIEWS_H_ #ifndef CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_ICON_VIEWS_H_
#define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_ICON_VIEWS_H_ #define CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_ICON_VIEWS_H_
#include "base/macros.h"
#include "chrome/browser/ui/passwords/manage_passwords_icon_view.h" #include "chrome/browser/ui/passwords/manage_passwords_icon_view.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h" #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "chrome/browser/ui/views/page_action/page_action_icon_view.h" #include "chrome/browser/ui/views/page_action/page_action_icon_view.h"
#include "ui/views/controls/image_view.h" #include "ui/views/controls/image_view.h"
#include "ui/views/metadata/metadata_header_macros.h"
class CommandUpdater; class CommandUpdater;
...@@ -17,12 +17,13 @@ class CommandUpdater; ...@@ -17,12 +17,13 @@ class CommandUpdater;
class ManagePasswordsIconViews : public ManagePasswordsIconView, class ManagePasswordsIconViews : public ManagePasswordsIconView,
public PageActionIconView { public PageActionIconView {
public: public:
static const char kClassName[]; METADATA_HEADER(ManagePasswordsIconViews);
ManagePasswordsIconViews( ManagePasswordsIconViews(
CommandUpdater* updater, CommandUpdater* updater,
IconLabelBubbleView::Delegate* icon_label_bubble_delegate, IconLabelBubbleView::Delegate* icon_label_bubble_delegate,
PageActionIconView::Delegate* page_action_icon_delegate); PageActionIconView::Delegate* page_action_icon_delegate);
ManagePasswordsIconViews(const ManagePasswordsIconViews&) = delete;
ManagePasswordsIconViews& operator=(const ManagePasswordsIconViews&) = delete;
~ManagePasswordsIconViews() override; ~ManagePasswordsIconViews() override;
// ManagePasswordsIconView: // ManagePasswordsIconView:
...@@ -38,7 +39,6 @@ class ManagePasswordsIconViews : public ManagePasswordsIconView, ...@@ -38,7 +39,6 @@ class ManagePasswordsIconViews : public ManagePasswordsIconView,
// views::View: // views::View:
void AboutToRequestFocusFromTabTraversal(bool reverse) override; void AboutToRequestFocusFromTabTraversal(bool reverse) override;
const char* GetClassName() const override;
private: private:
friend class ManagePasswordsIconViewTest; friend class ManagePasswordsIconViewTest;
...@@ -47,8 +47,6 @@ class ManagePasswordsIconViews : public ManagePasswordsIconView, ...@@ -47,8 +47,6 @@ class ManagePasswordsIconViews : public ManagePasswordsIconView,
void UpdateUiForState(); void UpdateUiForState();
password_manager::ui::State state_ = password_manager::ui::INACTIVE_STATE; password_manager::ui::State state_ = password_manager::ui::INACTIVE_STATE;
DISALLOW_COPY_AND_ASSIGN(ManagePasswordsIconViews);
}; };
#endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_ICON_VIEWS_H_ #endif // CHROME_BROWSER_UI_VIEWS_PASSWORDS_MANAGE_PASSWORDS_ICON_VIEWS_H_
...@@ -102,7 +102,7 @@ void PaymentRequestItemList::Item::Init() { ...@@ -102,7 +102,7 @@ void PaymentRequestItemList::Item::Init() {
content->SetCanProcessEventsWithinSubtree(false); content->SetCanProcessEventsWithinSubtree(false);
layout->AddView(std::move(content)); layout->AddView(std::move(content));
layout->AddView(CreateCheckmark(selected() && clickable())); layout->AddView(CreateCheckmark(selected() && GetClickable()));
if (extra_view) if (extra_view)
layout->AddView(std::move(extra_view)); layout->AddView(std::move(extra_view));
......
...@@ -9,13 +9,11 @@ ...@@ -9,13 +9,11 @@
#include "ui/native_theme/native_theme.h" #include "ui/native_theme/native_theme.h"
#include "ui/views/background.h" #include "ui/views/background.h"
#include "ui/views/border.h" #include "ui/views/border.h"
#include "ui/views/metadata/metadata_impl_macros.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
namespace payments { namespace payments {
// static
constexpr char PaymentRequestRowView::kClassName[];
PaymentRequestRowView::PaymentRequestRowView(PressedCallback callback, PaymentRequestRowView::PaymentRequestRowView(PressedCallback callback,
bool clickable, bool clickable,
const gfx::Insets& insets) const gfx::Insets& insets)
...@@ -34,8 +32,8 @@ PaymentRequestRowView::PaymentRequestRowView(PressedCallback callback, ...@@ -34,8 +32,8 @@ PaymentRequestRowView::PaymentRequestRowView(PressedCallback callback,
PaymentRequestRowView::~PaymentRequestRowView() {} PaymentRequestRowView::~PaymentRequestRowView() {}
const char* PaymentRequestRowView::GetClassName() const { bool PaymentRequestRowView::GetClickable() const {
return kClassName; return clickable_;
} }
void PaymentRequestRowView::SetActiveBackground() { void PaymentRequestRowView::SetActiveBackground() {
...@@ -73,7 +71,7 @@ void PaymentRequestRowView::SetIsHighlighted(bool highlighted) { ...@@ -73,7 +71,7 @@ void PaymentRequestRowView::SetIsHighlighted(bool highlighted) {
void PaymentRequestRowView::StateChanged(ButtonState old_state) { void PaymentRequestRowView::StateChanged(ButtonState old_state) {
Button::StateChanged(old_state); Button::StateChanged(old_state);
if (!clickable()) if (!GetClickable())
return; return;
SetIsHighlighted(GetState() == views::Button::STATE_HOVERED || SetIsHighlighted(GetState() == views::Button::STATE_HOVERED ||
...@@ -81,17 +79,21 @@ void PaymentRequestRowView::StateChanged(ButtonState old_state) { ...@@ -81,17 +79,21 @@ void PaymentRequestRowView::StateChanged(ButtonState old_state) {
} }
void PaymentRequestRowView::OnFocus() { void PaymentRequestRowView::OnFocus() {
if (clickable()) { if (GetClickable()) {
SetIsHighlighted(true); SetIsHighlighted(true);
SchedulePaint(); SchedulePaint();
} }
} }
void PaymentRequestRowView::OnBlur() { void PaymentRequestRowView::OnBlur() {
if (clickable()) { if (GetClickable()) {
SetIsHighlighted(false); SetIsHighlighted(false);
SchedulePaint(); SchedulePaint();
} }
} }
BEGIN_METADATA(PaymentRequestRowView, views::Button)
ADD_READONLY_PROPERTY_METADATA(bool, Clickable)
END_METADATA
} // namespace payments } // namespace payments
...@@ -5,9 +5,9 @@ ...@@ -5,9 +5,9 @@
#ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_ROW_VIEW_H_ #ifndef CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_ROW_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_ROW_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_PAYMENTS_PAYMENT_REQUEST_ROW_VIEW_H_
#include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "ui/views/controls/button/button.h" #include "ui/views/controls/button/button.h"
#include "ui/views/metadata/metadata_header_macros.h"
namespace payments { namespace payments {
...@@ -17,24 +17,22 @@ class PaymentRequestRowView ...@@ -17,24 +17,22 @@ class PaymentRequestRowView
: public views::Button, : public views::Button,
public base::SupportsWeakPtr<PaymentRequestRowView> { public base::SupportsWeakPtr<PaymentRequestRowView> {
public: public:
static constexpr char kClassName[] = "PaymentRequestRowView"; METADATA_HEADER(PaymentRequestRowView);
// Creates a row view. If |clickable| is true, the row will be shaded on hover // Creates a row view. If |clickable| is true, the row will be shaded on hover
// and handle click events. |insets| are used as padding around the content. // and handle click events. |insets| are used as padding around the content.
PaymentRequestRowView(PressedCallback callback, PaymentRequestRowView(PressedCallback callback,
bool clickable, bool clickable,
const gfx::Insets& insets); const gfx::Insets& insets);
PaymentRequestRowView(const PaymentRequestRowView&) = delete;
PaymentRequestRowView& operator=(const PaymentRequestRowView&) = delete;
~PaymentRequestRowView() override; ~PaymentRequestRowView() override;
void set_previous_row(base::WeakPtr<PaymentRequestRowView> previous_row) { void set_previous_row(base::WeakPtr<PaymentRequestRowView> previous_row) {
previous_row_ = previous_row; previous_row_ = previous_row;
} }
// views::View:
const char* GetClassName() const override;
protected: protected:
bool clickable() { return clickable_; } bool GetClickable() const;
private: private:
// Sets this row's background to the theme's hovered color to indicate that // Sets this row's background to the theme's hovered color to indicate that
...@@ -64,8 +62,6 @@ class PaymentRequestRowView ...@@ -64,8 +62,6 @@ class PaymentRequestRowView
// A non-owned pointer to the previous row object in the UI. Used to hide the // A non-owned pointer to the previous row object in the UI. Used to hide the
// bottom border of the previous row when highlighting this one. May be null. // bottom border of the previous row when highlighting this one. May be null.
base::WeakPtr<PaymentRequestRowView> previous_row_; base::WeakPtr<PaymentRequestRowView> previous_row_;
DISALLOW_COPY_AND_ASSIGN(PaymentRequestRowView);
}; };
} // namespace payments } // namespace payments
......
...@@ -85,12 +85,12 @@ class ProfileItem : public PaymentRequestItemList::Item { ...@@ -85,12 +85,12 @@ class ProfileItem : public PaymentRequestItemList::Item {
// In order to be selectable, a profile entry needs to be enabled, and the // In order to be selectable, a profile entry needs to be enabled, and the
// profile valid according to the controller. If either condition is false, // profile valid according to the controller. If either condition is false,
// PerformSelectionFallback() is called. // PerformSelectionFallback() is called.
return clickable() && controller_->IsValidProfile(*profile_); return GetClickable() && controller_->IsValidProfile(*profile_);
} }
void PerformSelectionFallback() override { void PerformSelectionFallback() override {
// If enabled, the editor is opened to complete the invalid profile. // If enabled, the editor is opened to complete the invalid profile.
if (clickable()) if (GetClickable())
controller_->ShowEditor(profile_); controller_->ShowEditor(profile_);
} }
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "ui/views/controls/button/button.h" #include "ui/views/controls/button/button.h"
#include "ui/views/controls/button/button_controller.h" #include "ui/views/controls/button/button_controller.h"
#include "ui/views/controls/highlight_path_generator.h" #include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/metadata/metadata_impl_macros.h"
#include "url/gurl.h" #include "url/gurl.h"
namespace { namespace {
...@@ -113,10 +114,6 @@ ReadLaterButton::ReadLaterButton(Browser* browser) ...@@ -113,10 +114,6 @@ ReadLaterButton::ReadLaterButton(Browser* browser)
ReadLaterButton::~ReadLaterButton() = default; ReadLaterButton::~ReadLaterButton() = default;
const char* ReadLaterButton::GetClassName() const {
return "ReadLaterButton";
}
void ReadLaterButton::CloseBubble() { void ReadLaterButton::CloseBubble() {
if (webui_bubble_manager_->GetBubbleWidget()) if (webui_bubble_manager_->GetBubbleWidget())
webui_bubble_manager_->CloseBubble(); webui_bubble_manager_->CloseBubble();
...@@ -215,3 +212,6 @@ void ReadLaterButton::ButtonPressed() { ...@@ -215,3 +212,6 @@ void ReadLaterButton::ButtonPressed() {
} }
} }
} }
BEGIN_METADATA(ReadLaterButton, views::LabelButton)
END_METADATA
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "components/reading_list/core/reading_list_model.h" #include "components/reading_list/core/reading_list_model.h"
#include "components/reading_list/core/reading_list_model_observer.h" #include "components/reading_list/core/reading_list_model_observer.h"
#include "ui/views/controls/button/label_button.h" #include "ui/views/controls/button/label_button.h"
#include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/widget/widget_observer.h" #include "ui/views/widget/widget_observer.h"
#include "ui/views/widget/widget_utils.h" #include "ui/views/widget/widget_utils.h"
...@@ -24,13 +25,12 @@ class ReadLaterButton : public views::LabelButton, ...@@ -24,13 +25,12 @@ class ReadLaterButton : public views::LabelButton,
public views::WidgetObserver, public views::WidgetObserver,
public ReadingListModelObserver { public ReadingListModelObserver {
public: public:
METADATA_HEADER(ReadLaterButton);
explicit ReadLaterButton(Browser* browser); explicit ReadLaterButton(Browser* browser);
ReadLaterButton(const ReadLaterButton&) = delete; ReadLaterButton(const ReadLaterButton&) = delete;
ReadLaterButton& operator=(const ReadLaterButton&) = delete; ReadLaterButton& operator=(const ReadLaterButton&) = delete;
~ReadLaterButton() override; ~ReadLaterButton() override;
const char* GetClassName() const override;
void CloseBubble(); void CloseBubble();
private: private:
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
#include "services/metrics/public/cpp/ukm_builders.h" #include "services/metrics/public/cpp/ukm_builders.h"
#include "services/metrics/public/cpp/ukm_recorder.h" #include "services/metrics/public/cpp/ukm_recorder.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/views/metadata/metadata_impl_macros.h"
using dom_distiller::UMAHelper; using dom_distiller::UMAHelper;
using dom_distiller::url_utils::IsDistilledPage; using dom_distiller::url_utils::IsDistilledPage;
...@@ -134,10 +135,6 @@ base::string16 ReaderModeIconView::GetTextForTooltipAndAccessibleName() const { ...@@ -134,10 +135,6 @@ base::string16 ReaderModeIconView::GetTextForTooltipAndAccessibleName() const {
: IDS_DISTILL_PAGE); : IDS_DISTILL_PAGE);
} }
const char* ReaderModeIconView::GetClassName() const {
return "ReaderModeIconView";
}
// TODO(gilmanmh): Consider displaying a bubble the first time a user // TODO(gilmanmh): Consider displaying a bubble the first time a user
// activates the icon to explain what Reader Mode is. // activates the icon to explain what Reader Mode is.
views::BubbleDialogDelegate* ReaderModeIconView::GetBubble() const { views::BubbleDialogDelegate* ReaderModeIconView::GetBubble() const {
...@@ -186,3 +183,6 @@ void ReaderModeIconView::OnResult( ...@@ -186,3 +183,6 @@ void ReaderModeIconView::OnResult(
UMAHelper::ReaderModePageType page_type = GetPageType(web_contents); UMAHelper::ReaderModePageType page_type = GetPageType(web_contents);
UMAHelper::StartTimerIfNeeded(web_contents, page_type); UMAHelper::StartTimerIfNeeded(web_contents, page_type);
} }
BEGIN_METADATA(ReaderModeIconView, PageActionIconView)
END_METADATA
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
#ifndef CHROME_BROWSER_UI_VIEWS_READER_MODE_READER_MODE_ICON_VIEW_H_ #ifndef CHROME_BROWSER_UI_VIEWS_READER_MODE_READER_MODE_ICON_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_READER_MODE_READER_MODE_ICON_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_READER_MODE_READER_MODE_ICON_VIEW_H_
#include "base/macros.h"
#include "base/strings/string16.h" #include "base/strings/string16.h"
#include "chrome/browser/ui/views/page_action/page_action_icon_view.h" #include "chrome/browser/ui/views/page_action/page_action_icon_view.h"
#include "components/dom_distiller/content/browser/distillable_page_utils.h" #include "components/dom_distiller/content/browser/distillable_page_utils.h"
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "ui/gfx/vector_icon_types.h" #include "ui/gfx/vector_icon_types.h"
#include "ui/views/metadata/metadata_header_macros.h"
namespace content { namespace content {
class NavigationHandle; class NavigationHandle;
...@@ -23,10 +23,13 @@ class ReaderModeIconView : public PageActionIconView, ...@@ -23,10 +23,13 @@ class ReaderModeIconView : public PageActionIconView,
public dom_distiller::DistillabilityObserver, public dom_distiller::DistillabilityObserver,
public content::WebContentsObserver { public content::WebContentsObserver {
public: public:
METADATA_HEADER(ReaderModeIconView);
ReaderModeIconView(CommandUpdater* command_updater, ReaderModeIconView(CommandUpdater* command_updater,
IconLabelBubbleView::Delegate* icon_label_bubble_delegate, IconLabelBubbleView::Delegate* icon_label_bubble_delegate,
PageActionIconView::Delegate* page_action_icon_delegate, PageActionIconView::Delegate* page_action_icon_delegate,
PrefService* pref_service); PrefService* pref_service);
ReaderModeIconView(const ReaderModeIconView&) = delete;
ReaderModeIconView& operator=(const ReaderModeIconView&) = delete;
~ReaderModeIconView() override; ~ReaderModeIconView() override;
protected: protected:
...@@ -43,7 +46,6 @@ class ReaderModeIconView : public PageActionIconView, ...@@ -43,7 +46,6 @@ class ReaderModeIconView : public PageActionIconView,
void UpdateImpl() override; void UpdateImpl() override;
const gfx::VectorIcon& GetVectorIcon() const override; const gfx::VectorIcon& GetVectorIcon() const override;
base::string16 GetTextForTooltipAndAccessibleName() const override; base::string16 GetTextForTooltipAndAccessibleName() const override;
const char* GetClassName() const override;
void OnExecuting(PageActionIconView::ExecuteSource execute_source) override; void OnExecuting(PageActionIconView::ExecuteSource execute_source) override;
// GetBubble() is required by PageActionIconView; however, the icon // GetBubble() is required by PageActionIconView; however, the icon
...@@ -55,8 +57,6 @@ class ReaderModeIconView : public PageActionIconView, ...@@ -55,8 +57,6 @@ class ReaderModeIconView : public PageActionIconView,
private: private:
PrefService* pref_service_; PrefService* pref_service_;
DISALLOW_COPY_AND_ASSIGN(ReaderModeIconView);
}; };
#endif // CHROME_BROWSER_UI_VIEWS_READER_MODE_READER_MODE_ICON_VIEW_H_ #endif // CHROME_BROWSER_UI_VIEWS_READER_MODE_READER_MODE_ICON_VIEW_H_
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "components/send_tab_to_self/features.h" #include "components/send_tab_to_self/features.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/strings/grit/ui_strings.h" #include "ui/strings/grit/ui_strings.h"
#include "ui/views/metadata/metadata_impl_macros.h"
namespace send_tab_to_self { namespace send_tab_to_self {
...@@ -100,10 +101,6 @@ const gfx::VectorIcon& SendTabToSelfIconView::GetVectorIcon() const { ...@@ -100,10 +101,6 @@ const gfx::VectorIcon& SendTabToSelfIconView::GetVectorIcon() const {
return kSendTabToSelfIcon; return kSendTabToSelfIcon;
} }
const char* SendTabToSelfIconView::GetClassName() const {
return "SendTabToSelfIconView";
}
base::string16 SendTabToSelfIconView::GetTextForTooltipAndAccessibleName() base::string16 SendTabToSelfIconView::GetTextForTooltipAndAccessibleName()
const { const {
return l10n_util::GetStringUTF16(IDS_OMNIBOX_TOOLTIP_SEND_TAB_TO_SELF); return l10n_util::GetStringUTF16(IDS_OMNIBOX_TOOLTIP_SEND_TAB_TO_SELF);
...@@ -159,4 +156,7 @@ void SendTabToSelfIconView::UpdateOpacity() { ...@@ -159,4 +156,7 @@ void SendTabToSelfIconView::UpdateOpacity() {
static_cast<float>(kLargeNumber)); static_cast<float>(kLargeNumber));
} }
BEGIN_METADATA(SendTabToSelfIconView, PageActionIconView)
END_METADATA
} // namespace send_tab_to_self } // namespace send_tab_to_self
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_UI_VIEWS_SEND_TAB_TO_SELF_SEND_TAB_TO_SELF_ICON_VIEW_H_ #ifndef CHROME_BROWSER_UI_VIEWS_SEND_TAB_TO_SELF_SEND_TAB_TO_SELF_ICON_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_SEND_TAB_TO_SELF_SEND_TAB_TO_SELF_ICON_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_SEND_TAB_TO_SELF_SEND_TAB_TO_SELF_ICON_VIEW_H_
#include "base/macros.h"
#include "chrome/browser/ui/views/page_action/page_action_icon_view.h" #include "chrome/browser/ui/views/page_action/page_action_icon_view.h"
#include "ui/views/metadata/metadata_header_macros.h"
class CommandUpdater; class CommandUpdater;
...@@ -18,10 +18,13 @@ class SendTabToSelfBubbleController; ...@@ -18,10 +18,13 @@ class SendTabToSelfBubbleController;
// choose to share the url to a target device. // choose to share the url to a target device.
class SendTabToSelfIconView : public PageActionIconView { class SendTabToSelfIconView : public PageActionIconView {
public: public:
METADATA_HEADER(SendTabToSelfIconView);
SendTabToSelfIconView( SendTabToSelfIconView(
CommandUpdater* command_updater, CommandUpdater* command_updater,
IconLabelBubbleView::Delegate* icon_label_bubble_delegate, IconLabelBubbleView::Delegate* icon_label_bubble_delegate,
PageActionIconView::Delegate* page_action_icon_delegate); PageActionIconView::Delegate* page_action_icon_delegate);
SendTabToSelfIconView(const SendTabToSelfIconView&) = delete;
SendTabToSelfIconView& operator=(const SendTabToSelfIconView&) = delete;
~SendTabToSelfIconView() override; ~SendTabToSelfIconView() override;
// PageActionIconView: // PageActionIconView:
...@@ -37,7 +40,6 @@ class SendTabToSelfIconView : public PageActionIconView { ...@@ -37,7 +40,6 @@ class SendTabToSelfIconView : public PageActionIconView {
// PageActionIconView: // PageActionIconView:
void OnExecuting(PageActionIconView::ExecuteSource execute_source) override; void OnExecuting(PageActionIconView::ExecuteSource execute_source) override;
const gfx::VectorIcon& GetVectorIcon() const override; const gfx::VectorIcon& GetVectorIcon() const override;
const char* GetClassName() const override;
// Updates the opacity according to the length of the label view as it is // Updates the opacity according to the length of the label view as it is
// shrinking. // shrinking.
...@@ -53,8 +55,6 @@ class SendTabToSelfIconView : public PageActionIconView { ...@@ -53,8 +55,6 @@ class SendTabToSelfIconView : public PageActionIconView {
// Indicates whether the "Sending..." animation has been shown since the last // Indicates whether the "Sending..." animation has been shown since the last
// time the omnibox was in focus. // time the omnibox was in focus.
AnimationState sending_animation_state_ = AnimationState::kNotShown; AnimationState sending_animation_state_ = AnimationState::kNotShown;
DISALLOW_COPY_AND_ASSIGN(SendTabToSelfIconView);
}; };
} // namespace send_tab_to_self } // namespace send_tab_to_self
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "ui/strings/grit/ui_strings.h" #include "ui/strings/grit/ui_strings.h"
#include "ui/views/animation/ink_drop.h" #include "ui/views/animation/ink_drop.h"
#include "ui/views/bubble/bubble_dialog_delegate_view.h" #include "ui/views/bubble/bubble_dialog_delegate_view.h"
#include "ui/views/metadata/metadata_impl_macros.h"
namespace { namespace {
// Progress state when the full length of the animation text is visible. // Progress state when the full length of the animation text is visible.
...@@ -85,7 +86,7 @@ void SharingIconView::UpdateImpl() { ...@@ -85,7 +86,7 @@ void SharingIconView::UpdateImpl() {
const bool is_bubble_showing = IsBubbleShowing(); const bool is_bubble_showing = IsBubbleShowing();
const bool is_visible = const bool is_visible =
is_bubble_showing || IsLoadingAnimationVisible() || label()->GetVisible(); is_bubble_showing || loading_animation_ || label()->GetVisible();
SetVisible(is_visible); SetVisible(is_visible);
UpdateInkDrop(is_bubble_showing); UpdateInkDrop(is_bubble_showing);
...@@ -151,10 +152,6 @@ const gfx::VectorIcon& SharingIconView::GetVectorIconBadge() const { ...@@ -151,10 +152,6 @@ const gfx::VectorIcon& SharingIconView::GetVectorIconBadge() const {
void SharingIconView::OnExecuting( void SharingIconView::OnExecuting(
PageActionIconView::ExecuteSource execute_source) {} PageActionIconView::ExecuteSource execute_source) {}
bool SharingIconView::IsLoadingAnimationVisible() {
return loading_animation_;
}
views::BubbleDialogDelegate* SharingIconView::GetBubble() const { views::BubbleDialogDelegate* SharingIconView::GetBubble() const {
auto* controller = GetController(); auto* controller = GetController();
return controller ? get_bubble_callback_.Run(controller->dialog()) : nullptr; return controller ? get_bubble_callback_.Run(controller->dialog()) : nullptr;
...@@ -171,6 +168,5 @@ base::string16 SharingIconView::GetTextForTooltipAndAccessibleName() const { ...@@ -171,6 +168,5 @@ base::string16 SharingIconView::GetTextForTooltipAndAccessibleName() const {
: base::string16(); : base::string16();
} }
const char* SharingIconView::GetClassName() const { BEGIN_METADATA(SharingIconView, PageActionIconView)
return "SharingIconView"; END_METADATA
}
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include "chrome/browser/sharing/sharing_ui_controller.h" #include "chrome/browser/sharing/sharing_ui_controller.h"
#include "chrome/browser/ui/views/page_action/page_action_icon_view.h" #include "chrome/browser/ui/views/page_action/page_action_icon_view.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "ui/views/metadata/metadata_header_macros.h"
namespace views { namespace views {
// TODO(ellyjones): Remove this. // TODO(ellyjones): Remove this.
...@@ -17,17 +18,20 @@ class BubbleDialogDelegateView; ...@@ -17,17 +18,20 @@ class BubbleDialogDelegateView;
// The location bar icon to show the sharing features bubble. // The location bar icon to show the sharing features bubble.
class SharingIconView : public PageActionIconView { class SharingIconView : public PageActionIconView {
public: public:
METADATA_HEADER(SharingIconView);
using GetControllerCallback = using GetControllerCallback =
base::RepeatingCallback<SharingUiController*(content::WebContents*)>; base::RepeatingCallback<SharingUiController*(content::WebContents*)>;
using GetBubbleCallback = using GetBubbleCallback =
base::RepeatingCallback<views::BubbleDialogDelegateView*(SharingDialog*)>; base::RepeatingCallback<views::BubbleDialogDelegateView*(SharingDialog*)>;
explicit SharingIconView( SharingIconView(IconLabelBubbleView::Delegate* icon_label_bubble_delegate,
IconLabelBubbleView::Delegate* icon_label_bubble_delegate, PageActionIconView::Delegate* page_action_icon_delegate,
PageActionIconView::Delegate* page_action_icon_delegate, GetControllerCallback get_controller,
GetControllerCallback get_controller, GetBubbleCallback get_bubble);
GetBubbleCallback get_bubble); SharingIconView(const SharingIconView&) = delete;
SharingIconView& operator=(const SharingIconView&) = delete;
~SharingIconView() override; ~SharingIconView() override;
void StartLoadingAnimation(); void StartLoadingAnimation();
...@@ -42,7 +46,6 @@ class SharingIconView : public PageActionIconView { ...@@ -42,7 +46,6 @@ class SharingIconView : public PageActionIconView {
void UpdateImpl() override; void UpdateImpl() override;
const gfx::VectorIcon& GetVectorIcon() const override; const gfx::VectorIcon& GetVectorIcon() const override;
base::string16 GetTextForTooltipAndAccessibleName() const override; base::string16 GetTextForTooltipAndAccessibleName() const override;
const char* GetClassName() const override;
// gfx::AnimationDelegate: // gfx::AnimationDelegate:
void AnimationProgressed(const gfx::Animation* animation) override; void AnimationProgressed(const gfx::Animation* animation) override;
...@@ -52,7 +55,6 @@ class SharingIconView : public PageActionIconView { ...@@ -52,7 +55,6 @@ class SharingIconView : public PageActionIconView {
void UpdateInkDrop(bool activate); void UpdateInkDrop(bool activate);
void UpdateOpacity(); void UpdateOpacity();
bool IsLoadingAnimationVisible();
private: private:
SharingUiController* last_controller_ = nullptr; SharingUiController* last_controller_ = nullptr;
...@@ -60,7 +62,5 @@ class SharingIconView : public PageActionIconView { ...@@ -60,7 +62,5 @@ class SharingIconView : public PageActionIconView {
bool should_show_error_ = false; bool should_show_error_ = false;
GetControllerCallback get_controller_callback_; GetControllerCallback get_controller_callback_;
GetBubbleCallback get_bubble_callback_; GetBubbleCallback get_bubble_callback_;
DISALLOW_COPY_AND_ASSIGN(SharingIconView);
}; };
#endif // CHROME_BROWSER_UI_VIEWS_SHARING_SHARING_ICON_VIEW_H_ #endif // CHROME_BROWSER_UI_VIEWS_SHARING_SHARING_ICON_VIEW_H_
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.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_impl_macros.h"
DiceBubbleSyncPromoView::DiceBubbleSyncPromoView( DiceBubbleSyncPromoView::DiceBubbleSyncPromoView(
Profile* profile, Profile* profile,
...@@ -86,6 +87,5 @@ void DiceBubbleSyncPromoView::EnableSync() { ...@@ -86,6 +87,5 @@ void DiceBubbleSyncPromoView::EnableSync() {
delegate_->OnEnableSync(account.value_or(AccountInfo())); delegate_->OnEnableSync(account.value_or(AccountInfo()));
} }
const char* DiceBubbleSyncPromoView::GetClassName() const { BEGIN_METADATA(DiceBubbleSyncPromoView, views::View)
return "DiceBubbleSyncPromoView"; END_METADATA
}
...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
#include <memory> #include <memory>
#include <vector> #include <vector>
#include "base/macros.h"
#include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h" #include "chrome/browser/ui/sync/bubble_sync_promo_delegate.h"
#include "components/signin/public/base/signin_metrics.h" #include "components/signin/public/base/signin_metrics.h"
#include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/style/typography.h" #include "ui/views/style/typography.h"
#include "ui/views/view.h" #include "ui/views/view.h"
...@@ -27,6 +27,7 @@ class DiceSigninButtonView; ...@@ -27,6 +27,7 @@ class DiceSigninButtonView;
// with the user full name and avatar icon and allows the user to enable sync. // with the user full name and avatar icon and allows the user to enable sync.
class DiceBubbleSyncPromoView : public views::View { class DiceBubbleSyncPromoView : public views::View {
public: public:
METADATA_HEADER(DiceBubbleSyncPromoView);
// Creates a personalized sync promo view. // Creates a personalized sync promo view.
// |delegate| is not owned by DiceBubbleSyncPromoView. // |delegate| is not owned by DiceBubbleSyncPromoView.
// The promo message is set to |accounts_promo_message_resource_id| when // The promo message is set to |accounts_promo_message_resource_id| when
...@@ -42,6 +43,8 @@ class DiceBubbleSyncPromoView : public views::View { ...@@ -42,6 +43,8 @@ class DiceBubbleSyncPromoView : public views::View {
int accounts_promo_message_resource_id = 0, int accounts_promo_message_resource_id = 0,
bool signin_button_prominent = true, bool signin_button_prominent = true,
int text_style = views::style::STYLE_PRIMARY); int text_style = views::style::STYLE_PRIMARY);
DiceBubbleSyncPromoView(const DiceBubbleSyncPromoView&) = delete;
DiceBubbleSyncPromoView& operator=(const DiceBubbleSyncPromoView&) = delete;
~DiceBubbleSyncPromoView() override; ~DiceBubbleSyncPromoView() override;
// Returns the sign-in button. // Returns the sign-in button.
...@@ -52,13 +55,8 @@ class DiceBubbleSyncPromoView : public views::View { ...@@ -52,13 +55,8 @@ class DiceBubbleSyncPromoView : public views::View {
// pressed. // pressed.
void EnableSync(); void EnableSync();
// views::View:
const char* GetClassName() const override;
// Delegate, to handle clicks on the sign-in buttons. // Delegate, to handle clicks on the sign-in buttons.
BubbleSyncPromoDelegate* delegate_; BubbleSyncPromoDelegate* delegate_;
DiceSigninButtonView* signin_button_view_ = nullptr; DiceSigninButtonView* signin_button_view_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(DiceBubbleSyncPromoView);
}; };
#endif // CHROME_BROWSER_UI_VIEWS_SYNC_DICE_BUBBLE_SYNC_PROMO_VIEW_H_ #endif // CHROME_BROWSER_UI_VIEWS_SYNC_DICE_BUBBLE_SYNC_PROMO_VIEW_H_
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "components/translate/core/browser/translate_metrics_logger.h" #include "components/translate/core/browser/translate_metrics_logger.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h" #include "ui/base/resource/resource_bundle.h"
#include "ui/views/metadata/metadata_impl_macros.h"
TranslateIconView::TranslateIconView( TranslateIconView::TranslateIconView(
CommandUpdater* command_updater, CommandUpdater* command_updater,
...@@ -75,6 +76,5 @@ base::string16 TranslateIconView::GetTextForTooltipAndAccessibleName() const { ...@@ -75,6 +76,5 @@ base::string16 TranslateIconView::GetTextForTooltipAndAccessibleName() const {
return l10n_util::GetStringUTF16(IDS_TOOLTIP_TRANSLATE); return l10n_util::GetStringUTF16(IDS_TOOLTIP_TRANSLATE);
} }
const char* TranslateIconView::GetClassName() const { BEGIN_METADATA(TranslateIconView, PageActionIconView)
return "TranslateIconView"; END_METADATA
}
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
#ifndef CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_ICON_VIEW_H_ #ifndef CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_ICON_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_ICON_VIEW_H_ #define CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_ICON_VIEW_H_
#include "base/macros.h"
#include "chrome/browser/ui/views/page_action/page_action_icon_view.h" #include "chrome/browser/ui/views/page_action/page_action_icon_view.h"
#include "ui/views/metadata/metadata_header_macros.h"
class CommandUpdater; class CommandUpdater;
...@@ -14,9 +14,12 @@ class CommandUpdater; ...@@ -14,9 +14,12 @@ class CommandUpdater;
// the page translated. // the page translated.
class TranslateIconView : public PageActionIconView { class TranslateIconView : public PageActionIconView {
public: public:
METADATA_HEADER(TranslateIconView);
TranslateIconView(CommandUpdater* command_updater, TranslateIconView(CommandUpdater* command_updater,
IconLabelBubbleView::Delegate* icon_label_bubble_delegate, IconLabelBubbleView::Delegate* icon_label_bubble_delegate,
PageActionIconView::Delegate* page_action_icon_delegate); PageActionIconView::Delegate* page_action_icon_delegate);
TranslateIconView(const TranslateIconView&) = delete;
TranslateIconView& operator=(const TranslateIconView&) = delete;
~TranslateIconView() override; ~TranslateIconView() override;
// PageActionIconView: // PageActionIconView:
...@@ -29,10 +32,6 @@ class TranslateIconView : public PageActionIconView { ...@@ -29,10 +32,6 @@ class TranslateIconView : public PageActionIconView {
void OnPressed(bool activated) override; void OnPressed(bool activated) override;
const gfx::VectorIcon& GetVectorIcon() const override; const gfx::VectorIcon& GetVectorIcon() const override;
base::string16 GetTextForTooltipAndAccessibleName() const override; base::string16 GetTextForTooltipAndAccessibleName() const override;
const char* GetClassName() const override;
private:
DISALLOW_COPY_AND_ASSIGN(TranslateIconView);
}; };
#endif // CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_ICON_VIEW_H_ #endif // CHROME_BROWSER_UI_VIEWS_TRANSLATE_TRANSLATE_ICON_VIEW_H_
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