Commit fa53f4f6 authored by Peter Boström's avatar Peter Boström Committed by Commit Bot

Add HighlightPathGenerator to more ash/system

Adds standard highlight-path generators to MoreButton in
unified_volume_view.cc as well as RoundedLabelButton and
UserAvatarButton.

Bug: chromium:1007546
Change-Id: I9f409bf7bd1058c5e4b1d6f41993bb3c42835dbd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1848653
Auto-Submit: Peter Boström <pbos@chromium.org>
Reviewed-by: default avatarTetsui Ohkubo <tetsui@chromium.org>
Commit-Queue: Peter Boström <pbos@chromium.org>
Cr-Commit-Position: refs/heads/master@{#704215}
parent 78180291
......@@ -22,9 +22,9 @@
#include "ui/views/animation/ink_drop_highlight.h"
#include "ui/views/animation/ink_drop_impl.h"
#include "ui/views/animation/ink_drop_mask.h"
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/controls/image_view.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/view_class_properties.h"
using chromeos::CrasAudioHandler;
......@@ -88,10 +88,7 @@ class MoreButton : public views::Button {
SetTooltipText(l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_AUDIO));
TrayPopupUtils::ConfigureTrayPopupButton(this);
auto path = std::make_unique<SkPath>();
path->addRoundRect(gfx::RectToSkRect(gfx::Rect(CalculatePreferredSize())),
kTrayItemSize / 2, kTrayItemSize / 2);
SetProperty(views::kHighlightPathKey, path.release());
views::InstallPillHighlightPathGenerator(this);
}
~MoreButton() override = default;
......@@ -126,11 +123,6 @@ class MoreButton : public views::Button {
UnifiedSystemTrayView::GetBackgroundColor());
}
std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override {
return std::make_unique<views::RoundRectInkDropMask>(size(), gfx::Insets(),
kTrayItemSize / 2);
}
const char* GetClassName() const override { return "MoreButton"; }
private:
......
......@@ -14,7 +14,7 @@
#include "ui/views/animation/ink_drop_mask.h"
#include "ui/views/animation/ink_drop_ripple.h"
#include "ui/views/border.h"
#include "ui/views/view_class_properties.h"
#include "ui/views/controls/highlight_path_generator.h"
namespace ash {
......@@ -30,11 +30,7 @@ RoundedLabelButton::RoundedLabelButton(views::ButtonListener* listener,
label()->SetFontList(views::Label::GetDefaultFontList().Derive(
1, gfx::Font::NORMAL, gfx::Font::Weight::MEDIUM));
TrayPopupUtils::ConfigureTrayPopupButton(this);
auto path = std::make_unique<SkPath>();
path->addRoundRect(gfx::RectToSkRect(gfx::Rect(CalculatePreferredSize())),
kTrayItemSize / 2, kTrayItemSize / 2);
SetProperty(views::kHighlightPathKey, path.release());
views::InstallPillHighlightPathGenerator(this);
}
RoundedLabelButton::~RoundedLabelButton() = default;
......
......@@ -23,6 +23,7 @@
#include "ash/system/unified/user_chooser_view.h"
#include "base/numerics/ranges.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/controls/highlight_path_generator.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/layout/fill_layout.h"
#include "ui/views/view_class_properties.h"
......@@ -50,12 +51,7 @@ UserAvatarButton::UserAvatarButton(views::ButtonListener* listener)
SetInstallFocusRingOnFocus(true);
SetFocusForPlatform();
int focus_ring_radius =
kTrayItemSize + kUnifiedCircularButtonFocusPadding.width();
auto path = std::make_unique<SkPath>();
path->addOval(gfx::RectToSkRect(
gfx::Rect(gfx::Size(focus_ring_radius, focus_ring_radius))));
SetProperty(views::kHighlightPathKey, path.release());
views::InstallCircleHighlightPathGenerator(this);
}
} // namespace
......
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