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

Unified Diff: chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.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 | « chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h ('k') | components/wallpaper/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..29a0a38524e9d718f543ed5daa3464b23409e089 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,9 @@ void WallpaperManager::OnWindowDestroying(aura::Window* window) {
}
void WallpaperManager::OnColorCalculationComplete() {
- SkColor color = color_calculator_->prominent_color();
+ size_t num_of_calculation = color_calculator_->prominent_colors().size();
+ DCHECK_EQ(1u, num_of_calculation);
+ SkColor color = color_calculator_->prominent_colors()[num_of_calculation];
color_calculator_->RemoveObserver(this);
color_calculator_.reset();
if (prominent_color_ == color)
« no previous file with comments | « chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h ('k') | components/wallpaper/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698