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

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: Address comments 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..ffd961d7858e02ea5d6b1088bd002b3a37b9175c 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);
+
+ 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;
@@ -159,6 +172,9 @@ class WallpaperManager
const AccountId& account_id,
std::unique_ptr<user_manager::UserImage> user_image);
+ // Sets |prominent_color_| and notifies the observers if there is a change.
+ void SetProminentColor(SkColor color);
+
// wallpaper::WallpaperManagerBase:
void InitializeRegisteredDeviceWallpaper() override;
bool GetUserWallpaperInfo(const AccountId& account_id,
@@ -238,6 +254,12 @@ class WallpaperManager
activation_client_observer_;
ScopedObserver<aura::Window, aura::WindowObserver> window_observer_;
+ // The prominent color extracted from the current wallpaper.
+ // SK_ColorTRANSPARENT is used if color extraction fails.
jdufault 2017/06/12 21:37:28 Use base::Optional<>. Try to avoid using magic val
Wenzhao (Colin) Zang 2017/06/12 23:40:34 Done.
+ 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