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, ...@@ -179,14 +179,11 @@ class ASH_EXPORT ShelfConfig : public TabletModeObserver,
bool in_tablet_mode() const { return in_tablet_mode_; } 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_; } 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. // Gets the current color for the shelf control buttons.
SkColor GetShelfControlButtonColor() const; SkColor GetShelfControlButtonColor() const;
......
...@@ -175,9 +175,10 @@ class LoginShelfButton : public views::LabelButton { ...@@ -175,9 +175,10 @@ class LoginShelfButton : public views::LabelButton {
SetFocusPainter(nullptr); SetFocusPainter(nullptr);
SetInkDropMode(InkDropMode::ON); SetInkDropMode(InkDropMode::ON);
set_has_ink_drop_action_on_click(true); set_has_ink_drop_action_on_click(true);
set_ink_drop_base_color(ShelfConfig::Get()->GetInkDropBaseColor()); AshColorProvider::RippleAttributes ripple_attributes =
set_ink_drop_visible_opacity( ShelfConfig::Get()->GetInkDropRippleAttributes();
ShelfConfig::Get()->GetInkDropVisibleOpacity()); 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 // Layer rendering is required when the shelf background is visible, which
// happens when the wallpaper is not blurred. // happens when the wallpaper is not blurred.
...@@ -291,9 +292,10 @@ class KioskAppsButton : public views::MenuButton, ...@@ -291,9 +292,10 @@ class KioskAppsButton : public views::MenuButton,
SetFocusPainter(nullptr); SetFocusPainter(nullptr);
SetInkDropMode(InkDropMode::ON); SetInkDropMode(InkDropMode::ON);
set_has_ink_drop_action_on_click(true); set_has_ink_drop_action_on_click(true);
set_ink_drop_base_color(ShelfConfig::Get()->GetInkDropBaseColor()); AshColorProvider::RippleAttributes ripple_attributes =
set_ink_drop_visible_opacity( ShelfConfig::Get()->GetInkDropRippleAttributes();
ShelfConfig::Get()->GetInkDropVisibleOpacity()); 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 // Layer rendering is required when the shelf background is visible, which
// happens when the wallpaper is not blurred. // happens when the wallpaper is not blurred.
......
...@@ -21,8 +21,10 @@ ShelfButton::ShelfButton(Shelf* shelf, ...@@ -21,8 +21,10 @@ ShelfButton::ShelfButton(Shelf* shelf,
shelf_button_delegate_(shelf_button_delegate) { shelf_button_delegate_(shelf_button_delegate) {
DCHECK(shelf_button_delegate_); DCHECK(shelf_button_delegate_);
set_hide_ink_drop_when_showing_context_menu(false); set_hide_ink_drop_when_showing_context_menu(false);
set_ink_drop_base_color(ShelfConfig::Get()->GetInkDropBaseColor()); AshColorProvider::RippleAttributes ripple_attributes =
set_ink_drop_visible_opacity(ShelfConfig::Get()->GetInkDropVisibleOpacity()); ShelfConfig::Get()->GetInkDropRippleAttributes();
set_ink_drop_base_color(ripple_attributes.base_color);
set_ink_drop_visible_opacity(ripple_attributes.inkdrop_opacity);
SetFocusBehavior(FocusBehavior::ALWAYS); SetFocusBehavior(FocusBehavior::ALWAYS);
SetInkDropMode(InkDropMode::ON_NO_GESTURE_HANDLER); SetInkDropMode(InkDropMode::ON_NO_GESTURE_HANDLER);
SetFocusPainter(views::Painter::CreateSolidFocusPainter( SetFocusPainter(views::Painter::CreateSolidFocusPainter(
......
...@@ -444,13 +444,9 @@ int ShelfConfig::GetShelfSize(bool ignore_in_app_state) const { ...@@ -444,13 +444,9 @@ int ShelfConfig::GetShelfSize(bool ignore_in_app_state) const {
return is_dense_ ? 48 : 56; return is_dense_ ? 48 : 56;
} }
SkColor ShelfConfig::GetInkDropBaseColor() const { AshColorProvider::RippleAttributes ShelfConfig::GetInkDropRippleAttributes()
return AshColorProvider::Get()->GetInkDropBaseColor( const {
AshColorProvider::AshColorMode::kDark); return AshColorProvider::Get()->GetRippleAttributes(GetDefaultShelfColor());
}
float ShelfConfig::GetInkDropVisibleOpacity() const {
return AshColorProvider::Get()->GetInkDropVisibleOpacity();
} }
SkColor ShelfConfig::GetShelfControlButtonColor() const { SkColor ShelfConfig::GetShelfControlButtonColor() const {
......
...@@ -272,17 +272,6 @@ SkColor AshColorProvider::GetBackgroundColor() const { ...@@ -272,17 +272,6 @@ SkColor AshColorProvider::GetBackgroundColor() const {
return IsThemed() ? GetBackgroundThemedColor() : GetBackgroundDefaultColor(); 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, void AshColorProvider::DecoratePillButton(views::LabelButton* button,
ButtonType type, ButtonType type,
const gfx::VectorIcon& icon) { const gfx::VectorIcon& icon) {
......
...@@ -205,12 +205,6 @@ class ASH_EXPORT AshColorProvider : public SessionObserver { ...@@ -205,12 +205,6 @@ class ASH_EXPORT AshColorProvider : public SessionObserver {
// |is_themed_|). // |is_themed_|).
SkColor GetBackgroundColor() const; 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 // 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 // on the type may style text, icon and background colors for both enabled and
// disabled states. May overwrite an prior styles on |button|. // disabled states. May overwrite an prior styles on |button|.
......
...@@ -58,7 +58,8 @@ HoldingSpaceItemChipView::HoldingSpaceItemChipView(const HoldingSpaceItem* item) ...@@ -58,7 +58,8 @@ HoldingSpaceItemChipView::HoldingSpaceItemChipView(const HoldingSpaceItem* item)
GetViewAccessibility().OverrideName(item_->text()); GetViewAccessibility().OverrideName(item_->text());
SetFocusBehavior(FocusBehavior::ALWAYS); SetFocusBehavior(FocusBehavior::ALWAYS);
SetInkDropMode(InkDropMode::ON_NO_GESTURE_HANDLER); 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); SetNotifyEnterExitOnChild(true);
// Ink drop layers should be clipped to match the corner radius of this view. // Ink drop layers should be clipped to match the corner radius of this view.
...@@ -76,7 +77,7 @@ HoldingSpaceItemChipView::HoldingSpaceItemChipView(const HoldingSpaceItem* item) ...@@ -76,7 +77,7 @@ HoldingSpaceItemChipView::HoldingSpaceItemChipView(const HoldingSpaceItem* item)
HoldingSpaceItemChipView::~HoldingSpaceItemChipView() = default; HoldingSpaceItemChipView::~HoldingSpaceItemChipView() = default;
SkColor HoldingSpaceItemChipView::GetInkDropBaseColor() const { SkColor HoldingSpaceItemChipView::GetInkDropBaseColor() const {
return ShelfConfig::Get()->GetInkDropBaseColor(); return ShelfConfig::Get()->GetInkDropRippleAttributes().base_color;
} }
int HoldingSpaceItemChipView::GetDragOperations(const gfx::Point& point) { int HoldingSpaceItemChipView::GetDragOperations(const gfx::Point& point) {
......
...@@ -160,8 +160,11 @@ TrayBackgroundView::TrayBackgroundView(Shelf* shelf) ...@@ -160,8 +160,11 @@ TrayBackgroundView::TrayBackgroundView(Shelf* shelf)
widget_observer_(new TrayWidgetObserver(this)) { widget_observer_(new TrayWidgetObserver(this)) {
DCHECK(shelf_); DCHECK(shelf_);
SetNotifyEnterExitOnChild(true); SetNotifyEnterExitOnChild(true);
set_ink_drop_base_color(ShelfConfig::Get()->GetInkDropBaseColor()); AshColorProvider::RippleAttributes ripple_attributes =
set_ink_drop_visible_opacity(ShelfConfig::Get()->GetInkDropVisibleOpacity()); 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); SetInkDropMode(InkDropMode::ON_NO_GESTURE_HANDLER);
SetLayoutManager(std::make_unique<views::FillLayout>()); 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