Commit c562735d authored by Thomas Tangl's avatar Thomas Tangl Committed by Commit Bot

[profile-menu] Make the heading a hover button

... instead of a link.

Bug: 1017152
Change-Id: I56a33b8a59c9592d5ef9df9aac6a68a84aa57fa8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1875105
Auto-Submit: Thomas Tangl <tangltom@chromium.org>
Commit-Queue: Ramin Halavati <rhalavati@chromium.org>
Reviewed-by: default avatarRamin Halavati <rhalavati@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708924}
parent 4b14f77f
...@@ -251,7 +251,7 @@ ProfileMenuViewBase::~ProfileMenuViewBase() { ...@@ -251,7 +251,7 @@ ProfileMenuViewBase::~ProfileMenuViewBase() {
void ProfileMenuViewBase::SetHeading(const base::string16& heading, void ProfileMenuViewBase::SetHeading(const base::string16& heading,
const base::string16& tooltip_text, const base::string16& tooltip_text,
base::RepeatingClosure action) { base::RepeatingClosure action) {
constexpr int kInsidePadding = 4; constexpr int kInsidePadding = 8;
const SkColor kBackgroundColor = const SkColor kBackgroundColor =
ui::NativeTheme::GetInstanceForNativeUi()->GetSystemColor( ui::NativeTheme::GetInstanceForNativeUi()->GetSystemColor(
ui::NativeTheme::kColorId_HighlightedMenuItemBackgroundColor); ui::NativeTheme::kColorId_HighlightedMenuItemBackgroundColor);
...@@ -260,16 +260,15 @@ void ProfileMenuViewBase::SetHeading(const base::string16& heading, ...@@ -260,16 +260,15 @@ void ProfileMenuViewBase::SetHeading(const base::string16& heading,
heading_container_->SetLayoutManager(std::make_unique<views::FillLayout>()); heading_container_->SetLayoutManager(std::make_unique<views::FillLayout>());
heading_container_->SetBackground( heading_container_->SetBackground(
views::CreateSolidBackground(kBackgroundColor)); views::CreateSolidBackground(kBackgroundColor));
heading_container_->SetBorder(
views::CreateEmptyBorder(gfx::Insets(kInsidePadding)));
views::Link* link = views::LabelButton* button = heading_container_->AddChildView(
heading_container_->AddChildView(std::make_unique<views::Link>(heading)); std::make_unique<HoverButton>(this, heading));
link->SetEnabledColor(views::style::GetColor( button->SetEnabledTextColors(views::style::GetColor(
*this, views::style::CONTEXT_LABEL, views::style::STYLE_SECONDARY)); *this, views::style::CONTEXT_LABEL, views::style::STYLE_SECONDARY));
link->SetTooltipText(tooltip_text); button->SetTooltipText(tooltip_text);
link->set_listener(this); button->SetHorizontalAlignment(gfx::ALIGN_CENTER);
RegisterClickAction(link, std::move(action)); button->SetBorder(views::CreateEmptyBorder(gfx::Insets(kInsidePadding)));
RegisterClickAction(button, std::move(action));
} }
void ProfileMenuViewBase::SetIdentityInfo(const gfx::ImageSkia& image, void ProfileMenuViewBase::SetIdentityInfo(const gfx::ImageSkia& image,
......
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