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

Add metadata to classes in c/b/ui/views/profiles.

Bug: 1159562
Change-Id: I236611f9223a6a9172a6b29a16ca947b43a4561d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2628085
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Reviewed-by: default avatarAllen Bauer <kylixrd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#843563}
parent 4473c0ae
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "ui/views/accessibility/view_accessibility.h" #include "ui/views/accessibility/view_accessibility.h"
#include "ui/views/controls/button/button_controller.h" #include "ui/views/controls/button/button_controller.h"
#include "ui/views/controls/button/label_button_border.h" #include "ui/views/controls/button/label_button_border.h"
#include "ui/views/metadata/metadata_impl_macros.h"
namespace { namespace {
...@@ -42,10 +43,6 @@ constexpr int kIconSizeForNonTouchUi = 22; ...@@ -42,10 +43,6 @@ constexpr int kIconSizeForNonTouchUi = 22;
} // namespace } // namespace
// static
const char AvatarToolbarButton::kAvatarToolbarButtonClassName[] =
"AvatarToolbarButton";
AvatarToolbarButton::AvatarToolbarButton(Browser* browser) AvatarToolbarButton::AvatarToolbarButton(Browser* browser)
: AvatarToolbarButton(browser, nullptr) {} : AvatarToolbarButton(browser, nullptr) {}
...@@ -192,10 +189,6 @@ void AvatarToolbarButton::ShowAvatarHighlightAnimation() { ...@@ -192,10 +189,6 @@ void AvatarToolbarButton::ShowAvatarHighlightAnimation() {
delegate_->ShowHighlightAnimation(); delegate_->ShowHighlightAnimation();
} }
bool AvatarToolbarButton::IsParentHighlighted() const {
return parent_ && parent_->GetHighlighted();
}
void AvatarToolbarButton::AddObserver(Observer* observer) { void AvatarToolbarButton::AddObserver(Observer* observer) {
observer_list_.AddObserver(observer); observer_list_.AddObserver(observer);
} }
...@@ -209,10 +202,6 @@ void AvatarToolbarButton::NotifyHighlightAnimationFinished() { ...@@ -209,10 +202,6 @@ void AvatarToolbarButton::NotifyHighlightAnimationFinished() {
observer.OnAvatarHighlightAnimationFinished(); observer.OnAvatarHighlightAnimationFinished();
} }
const char* AvatarToolbarButton::GetClassName() const {
return kAvatarToolbarButtonClassName;
}
void AvatarToolbarButton::OnMouseExited(const ui::MouseEvent& event) { void AvatarToolbarButton::OnMouseExited(const ui::MouseEvent& event) {
delegate_->OnMouseExited(); delegate_->OnMouseExited();
ToolbarButton::OnMouseExited(event); ToolbarButton::OnMouseExited(event);
...@@ -314,3 +303,6 @@ void AvatarToolbarButton::SetInsets() { ...@@ -314,3 +303,6 @@ void AvatarToolbarButton::SetInsets() {
touch_ui ? 0 : (kDefaultIconSize - kIconSizeForNonTouchUi) / 2); touch_ui ? 0 : (kDefaultIconSize - kIconSizeForNonTouchUi) / 2);
SetLayoutInsetDelta(layout_insets); SetLayoutInsetDelta(layout_insets);
} }
BEGIN_METADATA(AvatarToolbarButton, ToolbarButton)
END_METADATA
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
#define CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_TOOLBAR_BUTTON_H_ #define CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_TOOLBAR_BUTTON_H_
#include "base/feature_list.h" #include "base/feature_list.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/scoped_observation.h" #include "base/scoped_observation.h"
#include "chrome/browser/ui/views/toolbar/toolbar_button.h" #include "chrome/browser/ui/views/toolbar/toolbar_button.h"
#include "chrome/browser/ui/views/toolbar/toolbar_icon_container_view.h" #include "chrome/browser/ui/views/toolbar/toolbar_icon_container_view.h"
#include "ui/events/event.h" #include "ui/events/event.h"
#include "ui/views/metadata/metadata_header_macros.h"
class AvatarToolbarButtonDelegate; class AvatarToolbarButtonDelegate;
class Browser; class Browser;
...@@ -19,6 +19,8 @@ class Browser; ...@@ -19,6 +19,8 @@ class Browser;
class AvatarToolbarButton : public ToolbarButton, class AvatarToolbarButton : public ToolbarButton,
ToolbarIconContainerView::Observer { ToolbarIconContainerView::Observer {
public: public:
METADATA_HEADER(AvatarToolbarButton);
// States of the button ordered in priority of getting displayed. // States of the button ordered in priority of getting displayed.
enum class State { enum class State {
kIncognitoProfile, kIncognitoProfile,
...@@ -42,11 +44,12 @@ class AvatarToolbarButton : public ToolbarButton, ...@@ -42,11 +44,12 @@ class AvatarToolbarButton : public ToolbarButton,
// ToolbarIconContainerView as a parent. // ToolbarIconContainerView as a parent.
explicit AvatarToolbarButton(Browser* browser); explicit AvatarToolbarButton(Browser* browser);
AvatarToolbarButton(Browser* browser, ToolbarIconContainerView* parent); AvatarToolbarButton(Browser* browser, ToolbarIconContainerView* parent);
AvatarToolbarButton(const AvatarToolbarButton&) = delete;
AvatarToolbarButton& operator=(const AvatarToolbarButton&) = delete;
~AvatarToolbarButton() override; ~AvatarToolbarButton() override;
void UpdateText(); void UpdateText();
void ShowAvatarHighlightAnimation(); void ShowAvatarHighlightAnimation();
bool IsParentHighlighted() const;
void AddObserver(Observer* observer); void AddObserver(Observer* observer);
void RemoveObserver(Observer* observer); void RemoveObserver(Observer* observer);
...@@ -54,7 +57,6 @@ class AvatarToolbarButton : public ToolbarButton, ...@@ -54,7 +57,6 @@ class AvatarToolbarButton : public ToolbarButton,
void NotifyHighlightAnimationFinished(); void NotifyHighlightAnimationFinished();
// ToolbarButton: // ToolbarButton:
const char* GetClassName() const override;
void OnMouseExited(const ui::MouseEvent& event) override; void OnMouseExited(const ui::MouseEvent& event) override;
void OnBlur() override; void OnBlur() override;
void OnThemeChanged() override; void OnThemeChanged() override;
...@@ -64,8 +66,6 @@ class AvatarToolbarButton : public ToolbarButton, ...@@ -64,8 +66,6 @@ class AvatarToolbarButton : public ToolbarButton,
// ToolbarIconContainerView::Observer: // ToolbarIconContainerView::Observer:
void OnHighlightChanged() override; void OnHighlightChanged() override;
static const char kAvatarToolbarButtonClassName[];
protected: protected:
// ToolbarButton: // ToolbarButton:
void NotifyClick(const ui::Event& event) override; void NotifyClick(const ui::Event& event) override;
...@@ -88,8 +88,6 @@ class AvatarToolbarButton : public ToolbarButton, ...@@ -88,8 +88,6 @@ class AvatarToolbarButton : public ToolbarButton,
base::ObserverList<Observer>::Unchecked observer_list_; base::ObserverList<Observer>::Unchecked observer_list_;
base::WeakPtrFactory<AvatarToolbarButton> weak_ptr_factory_{this}; base::WeakPtrFactory<AvatarToolbarButton> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(AvatarToolbarButton);
}; };
#endif // CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_TOOLBAR_BUTTON_H_ #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_AVATAR_TOOLBAR_BUTTON_H_
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "ui/gfx/paint_vector_icon.h" #include "ui/gfx/paint_vector_icon.h"
#include "ui/native_theme/native_theme.h" #include "ui/native_theme/native_theme.h"
#include "ui/views/controls/image_view.h" #include "ui/views/controls/image_view.h"
#include "ui/views/metadata/metadata_impl_macros.h"
namespace { namespace {
...@@ -114,9 +115,6 @@ class BadgeView : public ::views::ImageView { ...@@ -114,9 +115,6 @@ class BadgeView : public ::views::ImageView {
} // namespace } // namespace
// static
const char BadgedProfilePhoto::kViewClassName[] = "BadgedProfilePhoto";
// BadgedProfilePhoto ------------------------------------------------- // BadgedProfilePhoto -------------------------------------------------
BadgedProfilePhoto::BadgedProfilePhoto(BadgeType badge_type, BadgedProfilePhoto::BadgedProfilePhoto(BadgeType badge_type,
...@@ -140,6 +138,5 @@ BadgedProfilePhoto::BadgedProfilePhoto(BadgeType badge_type, ...@@ -140,6 +138,5 @@ BadgedProfilePhoto::BadgedProfilePhoto(BadgeType badge_type,
gfx::Size(kBadgedProfilePhotoWidth, kBadgedProfilePhotoHeight)); gfx::Size(kBadgedProfilePhotoWidth, kBadgedProfilePhotoHeight));
} }
const char* BadgedProfilePhoto::GetClassName() const { BEGIN_METADATA(BadgedProfilePhoto, views::View)
return kViewClassName; END_METADATA
}
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define CHROME_BROWSER_UI_VIEWS_PROFILES_BADGED_PROFILE_PHOTO_H_ #define CHROME_BROWSER_UI_VIEWS_PROFILES_BADGED_PROFILE_PHOTO_H_
#include "ui/gfx/image/image.h" #include "ui/gfx/image/image.h"
#include "ui/views/metadata/metadata_header_macros.h"
#include "ui/views/view.h" #include "ui/views/view.h"
// Creates a bagded profile photo for the current profile card in the // Creates a bagded profile photo for the current profile card in the
...@@ -15,6 +16,8 @@ ...@@ -15,6 +16,8 @@
// DICE). // DICE).
class BadgedProfilePhoto : public views::View { class BadgedProfilePhoto : public views::View {
public: public:
METADATA_HEADER(BadgedProfilePhoto);
enum BadgeType { enum BadgeType {
BADGE_TYPE_NONE, BADGE_TYPE_NONE,
BADGE_TYPE_SUPERVISOR, BADGE_TYPE_SUPERVISOR,
...@@ -26,8 +29,6 @@ class BadgedProfilePhoto : public views::View { ...@@ -26,8 +29,6 @@ class BadgedProfilePhoto : public views::View {
BADGE_TYPE_SYNC_OFF, BADGE_TYPE_SYNC_OFF,
}; };
static const char kViewClassName[];
// Width/Height of the profile photo. // Width/Height of the profile photo.
static constexpr int kImageSize = 40; static constexpr int kImageSize = 40;
...@@ -39,12 +40,8 @@ class BadgedProfilePhoto : public views::View { ...@@ -39,12 +40,8 @@ class BadgedProfilePhoto : public views::View {
// profile photo. The size of the View is fixed. // profile photo. The size of the View is fixed.
// TODO(tangltom): Add accessibility features in the future. // TODO(tangltom): Add accessibility features in the future.
BadgedProfilePhoto(BadgeType badge_type, const gfx::Image& profile_photo); BadgedProfilePhoto(BadgeType badge_type, const gfx::Image& profile_photo);
BadgedProfilePhoto(const BadgedProfilePhoto&) = delete;
// views::View: BadgedProfilePhoto& operator=(const BadgedProfilePhoto&) = delete;
const char* GetClassName() const override;
private:
DISALLOW_COPY_AND_ASSIGN(BadgedProfilePhoto);
}; };
#endif // CHROME_BROWSER_UI_VIEWS_PROFILES_BADGED_PROFILE_PHOTO_H_ #endif // CHROME_BROWSER_UI_VIEWS_PROFILES_BADGED_PROFILE_PHOTO_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