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

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: Add image-loading class to small pods container 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..29d40d491ef3ad4b83af1d0b2db29f1410606e4a 100644
--- a/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h
+++ b/chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h
@@ -10,6 +10,7 @@
#include <vector>
#include "ash/public/interfaces/wallpaper.mojom.h"
+#include "ash/shelf/shelf_constants.h"
#include "base/macros.h"
#include "base/memory/ref_counted_memory.h"
#include "base/memory/weak_ptr.h"
@@ -19,12 +20,15 @@
#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"
#include "content/public/browser/notification_registrar.h"
#include "mojo/public/cpp/bindings/binding.h"
#include "ui/aura/window_observer.h"
+#include "ui/gfx/color_utils.h"
#include "ui/gfx/image/image_skia.h"
#include "ui/wm/public/activation_change_observer.h"
#include "ui/wm/public/activation_client.h"
@@ -113,6 +117,17 @@ class WallpaperManager
// aura::WindowObserver:
void OnWindowDestroying(aura::Window* window) override;
+ // Setting a non-NULL observer indicates that color calculation is needed
jdufault 2017/06/10 03:05:59 nit: non-null
Wenzhao (Colin) Zang 2017/06/12 21:10:58 Done.
+ // when a wallpaper is set.
jdufault 2017/06/10 03:05:59 Generally, try to avoid encoding state information
Wenzhao (Colin) Zang 2017/06/12 21:10:58 Done.
+ void SetLoginOverlayCalculatorObserver(
jdufault 2017/06/10 03:05:59 These functions should go above the overrides (ove
jdufault 2017/06/10 03:05:59 This should follow the standard AddObserver/Remove
Wenzhao (Colin) Zang 2017/06/12 21:10:58 Done.
Wenzhao (Colin) Zang 2017/06/12 21:10:58 Done.
+ wallpaper::WallpaperColorCalculatorObserver*);
jdufault 2017/06/10 03:05:59 Set a variable name here.
Wenzhao (Colin) Zang 2017/06/12 21:10:58 Done.
+
+ // Must be called after color calculation succeeds. Get the actual colors
+ // which will be used in login screen based on the prominent color.
+ void getLoginOverlayColors(std::string* dm_color,
jdufault 2017/06/10 03:05:59 nit: Out parameters should have out_ prefix.
jdufault 2017/06/10 03:05:59 nit: get -> Get
Wenzhao (Colin) Zang 2017/06/12 21:10:57 Done.
Wenzhao (Colin) Zang 2017/06/12 21:10:57 Done.
+ std::string* scroll_color,
+ std::string* background_color);
+
private:
friend class TestApi;
friend class WallpaperManagerBrowserTest;
@@ -159,6 +174,11 @@ class WallpaperManager
const AccountId& account_id,
std::unique_ptr<user_manager::UserImage> user_image);
+ // If the calculator observer is not NULL, calculate a prominent color based
jdufault 2017/06/10 03:05:59 nit: NULL -> null
Wenzhao (Colin) Zang 2017/06/12 21:10:58 Done.
+ // on the wallpaper image. An existing calculation in progress (if any) will
+ // be destroyed first.
+ void CalculateProminentColor(const gfx::ImageSkia& image);
+
// wallpaper::WallpaperManagerBase:
void InitializeRegisteredDeviceWallpaper() override;
bool GetUserWallpaperInfo(const AccountId& account_id,
@@ -240,6 +260,11 @@ class WallpaperManager
base::WeakPtrFactory<WallpaperManager> weak_factory_;
+ std::unique_ptr<wallpaper::WallpaperColorCalculator> color_calculator_;
+
+ wallpaper::WallpaperColorCalculatorObserver*
+ login_overlay_calculator_observer_;
+
DISALLOW_COPY_AND_ASSIGN(WallpaperManager);
};

Powered by Google App Engine
This is Rietveld 408576698