Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(244)

Unified Diff: ash/shelf/shelf_background_animator.cc

Issue 2943333003: Extracting more than one wallpaper prominent color (Closed)
Patch Set: possible uninitialized local value Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ash/wallpaper/wallpaper_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/shelf/shelf_background_animator.cc
diff --git a/ash/shelf/shelf_background_animator.cc b/ash/shelf/shelf_background_animator.cc
index b9500b0886d97a39b1daffb9030301db8163be4a..3be4ab766b59c61ea7193749d3fbbc4feefa76da 100644
--- a/ash/shelf/shelf_background_animator.cc
+++ b/ash/shelf/shelf_background_animator.cc
@@ -7,15 +7,50 @@
#include <algorithm>
#include "ash/animation/animation_change_type.h"
+#include "ash/ash_switches.h"
#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_background_animator_observer.h"
#include "ash/shelf/shelf_constants.h"
#include "ash/wallpaper/wallpaper_controller.h"
+#include "base/command_line.h"
#include "ui/gfx/animation/slide_animation.h"
+#include "ui/gfx/color_analysis.h"
#include "ui/gfx/color_utils.h"
+using ColorProfile = color_utils::ColorProfile;
+using LumaRange = color_utils::LumaRange;
+using SaturationRange = color_utils::SaturationRange;
+
namespace ash {
+namespace {
+
+// Returns color profile used for shelf based on the kAshShelfColorScheme
+// command line arg.
+ColorProfile GetShelfColorProfile() {
+ const std::string switch_value =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ switches::kAshShelfColorScheme);
+
+ ColorProfile color_profile(LumaRange::DARK, SaturationRange::MUTED);
+
+ if (switch_value.find("light") != std::string::npos)
+ color_profile.luma = LumaRange::LIGHT;
+ else if (switch_value.find("normal") != std::string::npos)
+ color_profile.luma = LumaRange::NORMAL;
+ else if (switch_value.find("dark") != std::string::npos)
+ color_profile.luma = LumaRange::DARK;
+
+ if (switch_value.find("vibrant") != std::string::npos)
+ color_profile.saturation = SaturationRange::VIBRANT;
+ else if (switch_value.find("muted") != std::string::npos)
+ color_profile.saturation = SaturationRange::MUTED;
+
+ return color_profile;
+}
+
+} // namespace
+
ShelfBackgroundAnimator::AnimationValues::AnimationValues() {}
ShelfBackgroundAnimator::AnimationValues::~AnimationValues() {}
@@ -213,9 +248,10 @@ void ShelfBackgroundAnimator::GetTargetValues(
break;
}
- SkColor target_color = wallpaper_controller_
- ? wallpaper_controller_->prominent_color()
- : kShelfDefaultBaseColor;
+ SkColor target_color =
+ wallpaper_controller_
+ ? wallpaper_controller_->GetProminentColor(GetShelfColorProfile())
+ : kShelfDefaultBaseColor;
if (target_color == WallpaperController::kInvalidColor) {
target_color = kShelfDefaultBaseColor;
} else {
« no previous file with comments | « no previous file | ash/wallpaper/wallpaper_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698