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

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

Issue 24625003: Delay wallpaper load by 2 * average wallpaper load time. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Catch WallpaperAnimationFinished event and inform JS. Created 7 years, 3 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/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/wallpaper_manager.h
diff --git a/chrome/browser/chromeos/login/wallpaper_manager.h b/chrome/browser/chromeos/login/wallpaper_manager.h
index cbf7af5add84640df06e6fce247545246c42ce98..8560d274b9dab0e690f9705e82f8c6302f79e712 100644
--- a/chrome/browser/chromeos/login/wallpaper_manager.h
+++ b/chrome/browser/chromeos/login/wallpaper_manager.h
@@ -64,7 +64,7 @@ extern const char kThumbnailWallpaperSubDir[];
// This class maintains wallpapers for users who have logged into this Chrome
// OS device.
-class WallpaperManager: public content::NotificationObserver {
+class WallpaperManager : public content::NotificationObserver {
public:
// For testing.
class TestApi {
@@ -80,6 +80,14 @@ class WallpaperManager: public content::NotificationObserver {
DISALLOW_COPY_AND_ASSIGN(TestApi);
};
+ class Observer : public base::RefCounted<Observer> {
+ public:
+ virtual ~Observer() {};
+ virtual void OnWallpaperAnimationFinished(const std::string& email) = 0;
+ };
+
+ typedef std::list<base::WeakPtr<Observer> > ObserverList;
dzhioev (left Google) 2013/10/17 12:47:49 Use ObserverList from base/observer_list.h
+
static WallpaperManager* Get();
WallpaperManager();
@@ -187,6 +195,9 @@ class WallpaperManager: public content::NotificationObserver {
// current display's resolution.
void UpdateWallpaper();
+ // Adds given observer to the list.
+ void AddObserver(base::WeakPtr<Observer> observer);
+
private:
friend class TestApi;
friend class WallpaperManagerBrowserTest;
@@ -287,6 +298,9 @@ class WallpaperManager: public content::NotificationObserver {
bool update_wallpaper,
const base::FilePath& wallpaper_path);
+ // Notify all registed observers.
+ void NotifyAnimationFinished();
+
// The number of loaded wallpapers.
int loaded_wallpapers_;
@@ -323,6 +337,8 @@ class WallpaperManager: public content::NotificationObserver {
content::NotificationRegistrar registrar_;
+ ObserverList observers_;
+
DISALLOW_COPY_AND_ASSIGN(WallpaperManager);
};
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/wallpaper_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698