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

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: Will clean up this CL when crbug.com/733709 is fixed 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 | « no previous file | chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc » ('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.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..d3962a8847f5de267afc7587e2c43c2e1ca5386c 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,14 +39,14 @@ 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;
~WallpaperManager() override;
- // Creates an instance of Wallpaper Manager. If there is no instance, create
- // one. Otherwise, returns the existing instance.
+ // Expects there is no instance of WallpaperManager and create one.
static void Initialize();
// Gets pointer to singleton WallpaperManager instance.
@@ -54,10 +56,23 @@ class WallpaperManager
// WallpaperManager to remove any observers it has registered.
static void Shutdown();
+ // Checks whether the instance exists. In general, please refrain from using
+ // this function. Use Get() directly when needing to access the singleton.
+ // TODO(crbug.com/733709): Remove this function when color calculation for
+ // login screen is moved elsewhere.
+ static bool HasInstance();
+
// Returns if the image is in the pending list. |image_id| can be obtained
// 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 +128,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 +256,14 @@ 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_;
+
+ // TODO(crbug.com/733709): Remove color calculation here when the old signin
+ // screen implementation is deprecated.
+ std::unique_ptr<wallpaper::WallpaperColorCalculator> color_calculator_;
+
base::WeakPtrFactory<WallpaperManager> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(WallpaperManager);
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698