Commit 143e723a authored by Ahmed Mehfooz's avatar Ahmed Mehfooz Committed by Commit Bot

Remove duplicated themed color calculations from shelf config

Bug: 1110760
Change-Id: I713b6810aa6d6f21da35e01bf12513df44a3ce8f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2398988Reviewed-by: default avatarXiyuan Xia <xiyuan@chromium.org>
Reviewed-by: default avatarMatthew Mourgos <mmourgos@chromium.org>
Commit-Queue: Ahmed Mehfooz <amehfooz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#805412}
parent cde5521b
......@@ -196,11 +196,6 @@ class ASH_EXPORT ShelfConfig : public TabletModeObserver,
// Gets the shelf color when a window is maximized.
SkColor GetMaximizedShelfColor() const;
// Calculates a themed color for shelf and system menu based on the wallpaper.
// Uses alpha value from the provided base_color, returns base_color unchanged
// if the wallpaper can not be used to generate a themed color.
SkColor GetThemedColorFromWallpaper(SkColor base_color) const;
// Gets the base layer type for shelf color.
AshColorProvider::BaseLayerType GetShelfBaseLayerType() const;
......
......@@ -474,26 +474,6 @@ SkColor ShelfConfig::GetMaximizedShelfColor() const {
return SkColorSetA(GetDefaultShelfColor(), 0xFF); // 100% opacity
}
SkColor ShelfConfig::GetThemedColorFromWallpaper(SkColor base_color) const {
if (!Shell::Get()->wallpaper_controller())
return base_color;
SkColor dark_muted_color =
Shell::Get()->wallpaper_controller()->GetProminentColor(
color_utils::ColorProfile(color_utils::LumaRange::DARK,
color_utils::SaturationRange::MUTED));
if (dark_muted_color == kInvalidWallpaperColor)
return base_color;
int base_alpha = SkColorGetA(base_color);
// Combine SK_ColorBLACK at 50% opacity with |dark_muted_color|.
base_color = color_utils::GetResultingPaintColor(
SkColorSetA(SK_ColorBLACK, 127), dark_muted_color);
return SkColorSetA(base_color, base_alpha);
}
AshColorProvider::BaseLayerType ShelfConfig::GetShelfBaseLayerType() const {
if (!chromeos::switches::ShouldShowShelfHotseat()) {
return in_tablet_mode_ ? AshColorProvider::BaseLayerType::kTransparent60
......@@ -513,16 +493,13 @@ AshColorProvider::BaseLayerType ShelfConfig::GetShelfBaseLayerType() const {
SkColor ShelfConfig::GetDefaultShelfColor() const {
if (!features::IsBackgroundBlurEnabled()) {
return GetThemedColorFromWallpaper(
AshColorProvider::Get()->GetBaseLayerColor(
AshColorProvider::BaseLayerType::kTransparent90));
return AshColorProvider::Get()->GetBaseLayerColor(
AshColorProvider::BaseLayerType::kTransparent90);
}
AshColorProvider::BaseLayerType layer_type = GetShelfBaseLayerType();
SkColor final_color = AshColorProvider::Get()->GetBaseLayerColor(layer_type);
return GetThemedColorFromWallpaper(final_color);
return AshColorProvider::Get()->GetBaseLayerColor(layer_type);
}
int ShelfConfig::GetShelfControlButtonBlurRadius() const {
......
......@@ -184,10 +184,7 @@ SkColor UnifiedSystemTrayView::GetBackgroundColor() {
? AshColorProvider::BaseLayerType::kTransparent90
: AshColorProvider::BaseLayerType::kTransparent80;
SkColor background_color =
AshColorProvider::Get()->GetBaseLayerColor(layer_type);
return ShelfConfig::Get()->GetThemedColorFromWallpaper(background_color);
return AshColorProvider::Get()->GetBaseLayerColor(layer_type);
}
// static
......
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