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