Commit f236e92d authored by Yulun Wu's avatar Yulun Wu Committed by Commit Bot

Deprecate inkdrop color and opacity getters in ash color provider.

Bug: 1127495
Change-Id: I34bc0d93516c4a4cb7fda7b9de049fe08ddc6112
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2406934Reviewed-by: default avatarMin Chen <minch@chromium.org>
Reviewed-by: default avatarAhmed Fakhry <afakhry@chromium.org>
Reviewed-by: default avatarYulun Wu <yulunwu@chromium.org>
Commit-Queue: Yulun Wu <yulunwu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806763}
parent 3a4679f6
......@@ -179,14 +179,11 @@ class ASH_EXPORT ShelfConfig : public TabletModeObserver,
bool in_tablet_mode() const { return in_tablet_mode_; }
// Ink drop color for shelf items.
SkColor GetInkDropBaseColor() const;
// Opacity of the ink drop ripple for shelf items when the ripple is visible.
float GetInkDropVisibleOpacity() const;
bool in_overview_mode() const { return overview_mode_; }
// Ink drop RippleAttributes for shelf items.
AshColorProvider::RippleAttributes GetInkDropRippleAttributes() const;
// Gets the current color for the shelf control buttons.
SkColor GetShelfControlButtonColor() const;
......
......@@ -175,9 +175,10 @@ class LoginShelfButton : public views::LabelButton {
SetFocusPainter(nullptr);
SetInkDropMode(InkDropMode::ON);
set_has_ink_drop_action_on_click(true);
set_ink_drop_base_color(ShelfConfig::Get()->GetInkDropBaseColor());
set_ink_drop_visible_opacity(
ShelfConfig::Get()->GetInkDropVisibleOpacity());
AshColorProvider::RippleAttributes ripple_attributes =
ShelfConfig::Get()->GetInkDropRippleAttributes();
set_ink_drop_base_color(ripple_attributes.base_color);
set_ink_drop_visible_opacity(ripple_attributes.inkdrop_opacity);
// Layer rendering is required when the shelf background is visible, which
// happens when the wallpaper is not blurred.
......@@ -291,9 +292,10 @@ class KioskAppsButton : public views::MenuButton,
SetFocusPainter(nullptr);
SetInkDropMode(InkDropMode::ON);
set_has_ink_drop_action_on_click(true);
set_ink_drop_base_color(ShelfConfig::Get()->GetInkDropBaseColor());
set_ink_drop_visible_opacity(
ShelfConfig::Get()->GetInkDropVisibleOpacity());
AshColorProvider::RippleAttributes ripple_attributes =
ShelfConfig::Get()->GetInkDropRippleAttributes();
set_ink_drop_base_color(ripple_attributes.base_color);
set_ink_drop_visible_opacity(ripple_attributes.inkdrop_opacity);
// Layer rendering is required when the shelf background is visible, which
// happens when the wallpaper is not blurred.
......
......@@ -21,8 +21,10 @@ ShelfButton::ShelfButton(Shelf* shelf,
shelf_button_delegate_(shelf_button_delegate) {
DCHECK(shelf_button_delegate_);
set_hide_ink_drop_when_showing_context_menu(false);
set_ink_drop_base_color(ShelfConfig::Get()->GetInkDropBaseColor());
set_ink_drop_visible_opacity(ShelfConfig::Get()->GetInkDropVisibleOpacity());
AshColorProvider::RippleAttributes ripple_attributes =
ShelfConfig::Get()->GetInkDropRippleAttributes();
set_ink_drop_base_color(ripple_attributes.base_color);
set_ink_drop_visible_opacity(ripple_attributes.inkdrop_opacity);
SetFocusBehavior(FocusBehavior::ALWAYS);
SetInkDropMode(InkDropMode::ON_NO_GESTURE_HANDLER);
SetFocusPainter(views::Painter::CreateSolidFocusPainter(
......
......@@ -444,13 +444,9 @@ int ShelfConfig::GetShelfSize(bool ignore_in_app_state) const {
return is_dense_ ? 48 : 56;
}
SkColor ShelfConfig::GetInkDropBaseColor() const {
return AshColorProvider::Get()->GetInkDropBaseColor(
AshColorProvider::AshColorMode::kDark);
}
float ShelfConfig::GetInkDropVisibleOpacity() const {
return AshColorProvider::Get()->GetInkDropVisibleOpacity();
AshColorProvider::RippleAttributes ShelfConfig::GetInkDropRippleAttributes()
const {
return AshColorProvider::Get()->GetRippleAttributes(GetDefaultShelfColor());
}
SkColor ShelfConfig::GetShelfControlButtonColor() const {
......
......@@ -272,17 +272,6 @@ SkColor AshColorProvider::GetBackgroundColor() const {
return IsThemed() ? GetBackgroundThemedColor() : GetBackgroundDefaultColor();
}
SkColor AshColorProvider::GetInkDropBaseColor(
AshColorMode given_color_mode) const {
AshColorMode color_mode =
color_mode_ != AshColorMode::kDefault ? color_mode_ : given_color_mode;
return color_mode == AshColorMode::kLight ? SK_ColorBLACK : SK_ColorWHITE;
}
float AshColorProvider::GetInkDropVisibleOpacity() const {
return 0.2f;
}
void AshColorProvider::DecoratePillButton(views::LabelButton* button,
ButtonType type,
const gfx::VectorIcon& icon) {
......
......@@ -205,12 +205,6 @@ class ASH_EXPORT AshColorProvider : public SessionObserver {
// |is_themed_|).
SkColor GetBackgroundColor() const;
// Ink drop color for shelf items.
SkColor GetInkDropBaseColor(AshColorMode given_color_mode) const;
// Opacity of the ink drop ripple for shelf items when the ripple is visible.
float GetInkDropVisibleOpacity() const;
// Helpers to style buttons based on the desired |type| and theme. Depending
// on the type may style text, icon and background colors for both enabled and
// disabled states. May overwrite an prior styles on |button|.
......
......@@ -58,7 +58,8 @@ HoldingSpaceItemChipView::HoldingSpaceItemChipView(const HoldingSpaceItem* item)
GetViewAccessibility().OverrideName(item_->text());
SetFocusBehavior(FocusBehavior::ALWAYS);
SetInkDropMode(InkDropMode::ON_NO_GESTURE_HANDLER);
set_ink_drop_visible_opacity(ShelfConfig::Get()->GetInkDropVisibleOpacity());
set_ink_drop_visible_opacity(
ShelfConfig::Get()->GetInkDropRippleAttributes().inkdrop_opacity);
SetNotifyEnterExitOnChild(true);
// Ink drop layers should be clipped to match the corner radius of this view.
......@@ -76,7 +77,7 @@ HoldingSpaceItemChipView::HoldingSpaceItemChipView(const HoldingSpaceItem* item)
HoldingSpaceItemChipView::~HoldingSpaceItemChipView() = default;
SkColor HoldingSpaceItemChipView::GetInkDropBaseColor() const {
return ShelfConfig::Get()->GetInkDropBaseColor();
return ShelfConfig::Get()->GetInkDropRippleAttributes().base_color;
}
int HoldingSpaceItemChipView::GetDragOperations(const gfx::Point& point) {
......
......@@ -160,8 +160,11 @@ TrayBackgroundView::TrayBackgroundView(Shelf* shelf)
widget_observer_(new TrayWidgetObserver(this)) {
DCHECK(shelf_);
SetNotifyEnterExitOnChild(true);
set_ink_drop_base_color(ShelfConfig::Get()->GetInkDropBaseColor());
set_ink_drop_visible_opacity(ShelfConfig::Get()->GetInkDropVisibleOpacity());
AshColorProvider::RippleAttributes ripple_attributes =
ShelfConfig::Get()->GetInkDropRippleAttributes();
set_ink_drop_base_color(ripple_attributes.base_color);
set_ink_drop_visible_opacity(ripple_attributes.inkdrop_opacity);
SetInkDropMode(InkDropMode::ON_NO_GESTURE_HANDLER);
SetLayoutManager(std::make_unique<views::FillLayout>());
......
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