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

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

Issue 221873005: Some cleanup of WallpaperManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
Patch Set: Compilation fixes. Created 6 years, 8 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/wallpaper_manager.h
diff --git a/chrome/browser/chromeos/login/wallpaper_manager.h b/chrome/browser/chromeos/login/wallpaper_manager.h
index 2dae2fa76d62af4b17721be410edb21c4541fd0b..a2ae56d4dbd15a286dbd6b414ef5b68f9918a28a 100644
--- a/chrome/browser/chromeos/login/wallpaper_manager.h
+++ b/chrome/browser/chromeos/login/wallpaper_manager.h
@@ -206,19 +206,12 @@ class WallpaperManager: public content::NotificationObserver {
// wallpaper of logged in user.
void EnsureLoggedInUserWallpaperLoaded();
- // Clears disposable ONLINE and CUSTOM wallpaper cache. At multi profile
- // world, logged in users' wallpaper cache is not disposable.
- void ClearDisposableWallpaperCache();
-
// Returns custom wallpaper path. Append |sub_dir|, |user_id_hash| and |file|
// to custom wallpaper directory.
base::FilePath GetCustomWallpaperPath(const char* sub_dir,
const std::string& user_id_hash,
const std::string& file) const;
- // Returns filepath to save original custom wallpaper for the given user.
- base::FilePath GetOriginalWallpaperPathForUser(const std::string& user_id);
-
// Gets wallpaper information of logged in user.
bool GetLoggedInUserWallpaperInfo(WallpaperInfo* info);
@@ -237,7 +230,7 @@ class WallpaperManager: public content::NotificationObserver {
// Resizes |wallpaper| to a resolution which is nearest to |preferred_width|
// and |preferred_height| while maintaining aspect ratio.
- bool ResizeWallpaper(const UserImage& wallpaper,
+ bool ResizeWallpaper(const gfx::ImageSkia& wallpaper,
ash::WallpaperLayout layout,
int preferred_width,
int preferred_height,
@@ -248,7 +241,7 @@ class WallpaperManager: public content::NotificationObserver {
// and |preferred_height| while maintaining aspect ratio. And saves the
// resized wallpaper to |path|. |result| is optional (may be NULL).
// Returns true on success.
- bool ResizeAndSaveWallpaper(const UserImage& wallpaper,
+ bool ResizeAndSaveWallpaper(const gfx::ImageSkia& wallpaper,
const base::FilePath& path,
ash::WallpaperLayout layout,
int preferred_width,
@@ -263,7 +256,7 @@ class WallpaperManager: public content::NotificationObserver {
const std::string& file,
ash::WallpaperLayout layout,
User::WallpaperType type,
- const UserImage& wallpaper,
+ const gfx::ImageSkia& wallpaper,
bool update_wallpaper);
// Sets wallpaper to default wallpaper (asynchronously with zero delay).
@@ -272,20 +265,12 @@ class WallpaperManager: public content::NotificationObserver {
// Sets wallpaper to default wallpaper (asynchronously with default delay).
void SetDefaultWallpaperDelayed(const std::string& user_id);
- // Initialize wallpaper for the specified user to default and saves this
- // settings in local state.
- void InitInitialUserWallpaper(const std::string& user_id,
- bool is_persistent);
-
// Sets selected wallpaper information for |user_id| and saves it to Local
// State if |is_persistent| is true.
void SetUserWallpaperInfo(const std::string& user_id,
const WallpaperInfo& info,
bool is_persistent);
- // Sets last selected user on user pod row.
- void SetLastSelectedUser(const std::string& last_selected_user);
-
// Sets |user_id|'s wallpaper (asynchronously with zero delay).
void SetUserWallpaperNow(const std::string& user_id);
@@ -336,7 +321,13 @@ class WallpaperManager: public content::NotificationObserver {
typedef std::map<std::string, gfx::ImageSkia> CustomWallpaperMap;
- // Set |wallpaper| controlled by policy.
+ // Initialize wallpaper for the specified user to default and saves this
+ // settings in local state.
+ void InitInitialUserWallpaper(const std::string& user_id,
+ bool is_persistent);
+
+ // Set |wallpaper| controlled by policy. (Takes a UserImage because that's
+ // the callback interface provided by UserImageLoader.)
void SetPolicyControlledWallpaper(const std::string& user_id,
const UserImage& wallpaper);
@@ -362,14 +353,19 @@ class WallpaperManager: public content::NotificationObserver {
// Caches |user_id|'s wallpaper to memory.
void CacheUserWallpaper(const std::string& user_id);
+ // Clears disposable ONLINE and CUSTOM wallpaper cache. At multi profile
+ // world, logged in users' wallpaper cache is not disposable.
+ void ClearDisposableWallpaperCache();
+
// Clears all obsolete wallpaper prefs from old version wallpaper pickers.
void ClearObsoleteWallpaperPrefs();
// Deletes everything else except |path| in the same directory.
- void DeleteAllExcept(const base::FilePath& path);
+ static void DeleteAllExcept(const base::FilePath& path);
// Deletes a list of wallpaper files in |file_list|.
- void DeleteWallpaperInList(const std::vector<base::FilePath>& file_list);
+ static void DeleteWallpaperInList(
+ const std::vector<base::FilePath>& file_list);
// Deletes all |user_id| related custom wallpapers and directories.
void DeleteUserWallpapers(const std::string& user_id,
@@ -377,7 +373,7 @@ class WallpaperManager: public content::NotificationObserver {
// Creates all new custom wallpaper directories for |user_id_hash| if not
// exist.
- void EnsureCustomWallpaperDirectories(const std::string& user_id_hash);
+ static void EnsureCustomWallpaperDirectories(const std::string& user_id_hash);
// Gets the CommandLine representing the current process's command line.
base::CommandLine* GetCommandLine();
@@ -424,22 +420,15 @@ class WallpaperManager: public content::NotificationObserver {
WallpaperInfo* info) const;
// Sets wallpaper to the decoded wallpaper if |update_wallpaper| is true.
- // Otherwise, cache wallpaper to memory if not logged in.
+ // Otherwise, cache wallpaper to memory if not logged in. (Takes a UserImage
+ // because that's the callback interface provided by UserImageLoader.)
Nikita (slow) 2014/04/18 09:28:19 nit: Delete one of the new lines? Seems to be dupl
Thiemo Nagel 2014/04/23 17:14:06 Thanks! Fixed.
+ // because it's called back from UserImageLoader.)
void OnWallpaperDecoded(const std::string& user_id,
ash::WallpaperLayout layout,
bool update_wallpaper,
MovableOnDestroyCallbackHolder on_finish,
const UserImage& wallpaper);
- // Generates thumbnail of custom wallpaper on wallpaper sequenced worker
- // thread. If |persistent| is true, saves original custom image and resized
- // images to disk.
- void ProcessCustomWallpaper(const std::string& user_id_hash,
- bool persistent,
- const WallpaperInfo& info,
- scoped_ptr<gfx::ImageSkia> image,
- const UserImage::RawImage& raw_image);
-
// Record data for User Metrics Analysis.
void RecordUma(User::WallpaperType type, int index) const;
@@ -448,7 +437,7 @@ class WallpaperManager: public content::NotificationObserver {
void SaveCustomWallpaper(const std::string& user_id_hash,
const base::FilePath& path,
ash::WallpaperLayout layout,
- const UserImage& wallpaper);
+ scoped_ptr<gfx::ImageSkia> wallpaper) const;
// Saves wallpaper image raw |data| to |path| (absolute path) in file system.
// True on success.
@@ -475,7 +464,7 @@ class WallpaperManager: public content::NotificationObserver {
// After completed load operation, update average load time.
void SaveLastLoadTime(const base::TimeDelta elapsed);
- // Notify all registed observers.
+ // Notify all registered observers.
void NotifyAnimationFinished();
// Returns modifiable PendingWallpaper.

Powered by Google App Engine
This is Rietveld 408576698