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

Unified Diff: components/wallpaper/wallpaper_color_calculator.h

Issue 2943333003: Extracting more than one wallpaper prominent color (Closed)
Patch Set: UMA 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
Index: components/wallpaper/wallpaper_color_calculator.h
diff --git a/components/wallpaper/wallpaper_color_calculator.h b/components/wallpaper/wallpaper_color_calculator.h
index c59c12e7139384e02317bdd099c5ae515ba95f0c..2805f11ad313231d1da63c78051a46b0cecb98a7 100644
--- a/components/wallpaper/wallpaper_color_calculator.h
+++ b/components/wallpaper/wallpaper_color_calculator.h
@@ -25,11 +25,10 @@ class WallpaperColorCalculatorObserver;
// Calculates colors based on a wallpaper image.
class WALLPAPER_EXPORT WallpaperColorCalculator {
public:
- // |image|, |luma| and |saturation| are the input parameters to the color
- // calculation that is executed on the |task_runner|.
+ // |image|, |color_profiles| are the input parameters to the color calculation
+ // that is executed on the |task_runner|.
WallpaperColorCalculator(const gfx::ImageSkia& image,
- color_utils::LumaRange luma,
- color_utils::SaturationRange saturation,
+ const color_utils::ColorProfiles& color_profiles,
scoped_refptr<base::TaskRunner> task_runner);
~WallpaperColorCalculator();
@@ -42,10 +41,11 @@ class WALLPAPER_EXPORT WallpaperColorCalculator {
// Callers should be aware that this will make |image_| read-only.
bool StartCalculation() WARN_UNUSED_RESULT;
- SkColor prominent_color() const { return prominent_color_; }
+ std::vector<SkColor> prominent_colors() const { return prominent_colors_; }
- void set_prominent_color_for_test(SkColor prominent_color) {
- prominent_color_ = prominent_color;
+ void set_prominent_colors_for_test(
+ const std::vector<SkColor>& prominent_colors) {
+ prominent_colors_ = prominent_colors;
}
// Explicitly sets the |task_runner_| for testing.
@@ -55,23 +55,20 @@ class WALLPAPER_EXPORT WallpaperColorCalculator {
// Handles asynchronous calculation results. |async_start_time| is used to
// record duration metrics.
void OnAsyncCalculationComplete(base::TimeTicks async_start_time,
- SkColor prominent_color);
+ const std::vector<SkColor>& prominent_colors);
// Notifies observers that a color calulation has completed. Called on the
// same thread that constructed |this|.
- void NotifyCalculationComplete(SkColor prominent_color);
+ void NotifyCalculationComplete(const std::vector<SkColor>& prominent_colors);
// The result of the color calculation.
- SkColor prominent_color_ = SK_ColorTRANSPARENT;
+ std::vector<SkColor> prominent_colors_;
// The image to calculate colors from.
gfx::ImageSkia image_;
- // Input for the color calculation.
- color_utils::LumaRange luma_;
-
- // Input for the color calculation.
- color_utils::SaturationRange saturation_;
+ // The color profiles used to calculate colors.
+ color_utils::ColorProfiles color_profiles_;
// The task runner to run the calculation on.
scoped_refptr<base::TaskRunner> task_runner_;

Powered by Google App Engine
This is Rietveld 408576698