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

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

Issue 2931063004: Extract colors from wallpaper and dynamically update login screen overlay (Closed)
Patch Set: Move unrelated style changes to a separate CL 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.h
diff --git a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h
index cefafb3734460443239feb5ed5594c6acde51c75..f221a529b4519cc561f59bf8eea71727222ba2be 100644
--- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h
+++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h
@@ -19,6 +19,8 @@
#include "components/user_manager/user.h"
#include "components/user_manager/user_image/user_image.h"
#include "components/user_manager/user_manager.h"
+#include "components/wallpaper/wallpaper_color_calculator.h"
+#include "components/wallpaper/wallpaper_color_calculator_observer.h"
#include "components/wallpaper/wallpaper_layout.h"
#include "components/wallpaper/wallpaper_manager_base.h"
#include "content/public/browser/notification_observer.h"
@@ -37,7 +39,8 @@ class WallpaperManager
public content::NotificationObserver,
public user_manager::UserManager::UserSessionStateObserver,
public wm::ActivationChangeObserver,
- public aura::WindowObserver {
+ public aura::WindowObserver,
+ public wallpaper::WallpaperColorCalculatorObserver {
public:
class PendingWallpaper;
@@ -58,6 +61,13 @@ class WallpaperManager
// from gfx::ImageSkia by using WallpaperResizer::GetImageId().
bool IsPendingWallpaper(uint32_t image_id);
+ // Calculates a prominent color based on the wallpaper image and notifies
+ // |observers_| of the value. An existing calculation in progress (if any)
+ // will be destroyed first.
+ void CalculateProminentColor(const gfx::ImageSkia& image);
+
+ base::Optional<SkColor> prominent_color() const { return prominent_color_; }
+
// wallpaper::WallpaperManagerBase:
WallpaperResolution GetAppropriateResolution() override;
void AddObservers() override;
@@ -113,6 +123,9 @@ class WallpaperManager
// aura::WindowObserver:
void OnWindowDestroying(aura::Window* window) override;
+ // wallpaper::WallpaperColorCalculatorObserver:
+ void OnColorCalculationComplete() override;
+
private:
friend class TestApi;
friend class WallpaperManagerBrowserTest;
@@ -238,6 +251,12 @@ class WallpaperManager
activation_client_observer_;
ScopedObserver<aura::Window, aura::WindowObserver> window_observer_;
+ // The prominent color extracted from the current wallpaper. It doesn't have
+ // value if color extraction fails.
+ base::Optional<SkColor> prominent_color_;
+
+ std::unique_ptr<wallpaper::WallpaperColorCalculator> color_calculator_;
+
base::WeakPtrFactory<WallpaperManager> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(WallpaperManager);

Powered by Google App Engine
This is Rietveld 408576698