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

Unified Diff: chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc

Issue 2943333003: Extracting more than one wallpaper prominent color (Closed)
Patch Set: feedback from ps4 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: chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
index 8621f3677fe6f02e5de8a42746d601f3f7e9dcc0..4b27e38a6506bad624ef5dd6cd8a6351701bde40 100644
--- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
+++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc
@@ -63,6 +63,7 @@
#include "content/public/common/service_manager_connection.h"
#include "crypto/sha2.h"
#include "services/service_manager/public/cpp/connector.h"
+#include "ui/gfx/color_analysis.h"
#include "url/gurl.h"
using content::BrowserThread;
@@ -444,9 +445,12 @@ void WallpaperManager::CalculateProminentColor(const gfx::ImageSkia& image) {
color_calculator_.reset();
}
+ // TODO(warx): this color fetching should go through ash::WallpaperController.
+ std::vector<color_utils::ColorProfile> color_profiles;
+ color_profiles.emplace_back(color_utils::LumaRange::DARK,
+ color_utils::SaturationRange::MUTED);
color_calculator_ = base::MakeUnique<wallpaper::WallpaperColorCalculator>(
- image, color_utils::LumaRange::DARK, color_utils::SaturationRange::MUTED,
- task_runner_);
+ image, color_profiles, task_runner_);
color_calculator_->AddObserver(this);
if (!color_calculator_->StartCalculation()) {
color_calculator_->RemoveObserver(this);
@@ -944,7 +948,7 @@ void WallpaperManager::OnWindowDestroying(aura::Window* window) {
}
void WallpaperManager::OnColorCalculationComplete() {
- SkColor color = color_calculator_->prominent_color();
+ SkColor color = color_calculator_->prominent_colors()[0];
bruthig 2017/06/21 15:54:17 '0' seems like a magic number here.
Qiang(Joe) Xu 2017/06/21 22:35:27 Done.
color_calculator_->RemoveObserver(this);
color_calculator_.reset();
if (prominent_color_ == color)

Powered by Google App Engine
This is Rietveld 408576698