Chromium Code Reviews| 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 07b7a1d56b0be2e1d00ca96cad96ce0f4fff1e05..46634ebb9b755b876cf6ef3d4ee960cdd29348c8 100644 |
| --- a/chrome/browser/chromeos/login/wallpaper_manager.h |
| +++ b/chrome/browser/chromeos/login/wallpaper_manager.h |
| @@ -8,6 +8,7 @@ |
| #include <string> |
| #include "ash/desktop_background/desktop_background_resources.h" |
| +#include "base/memory/ref_counted_memory.h" |
| #include "base/memory/weak_ptr.h" |
| #include "base/time.h" |
| #include "base/timer.h" |
| @@ -60,16 +61,21 @@ class WallpaperManager: public system::TimezoneSettings::Observer, |
| // wallpaper of logged in user. |
| void EnsureLoggedInUserWallpaperLoaded(); |
| - // Fetches |email|'s wallpaper from local disk. |
| - void FetchCustomWallpaper(const std::string& email); |
| + // Gets |email|'s wallpaper from local disk. |
| + void GetCustomWallpaper(const std::string& email); |
| // Gets encoded custom wallpaper from cache. Returns true if success. |
| bool GetCustomWallpaperFromCache(const std::string& email, |
| gfx::ImageSkia* wallpaper); |
| - // Returns wallpaper/thumbnail filepath for the given user. |
| + // Returns filepath to save original custom wallpaper for the given user. |
| + FilePath GetOriginalWallpaperPathForUser(const std::string& username); |
| + |
| + // Returns small resolution custom wallpaper filepath for the given user when |
| + // |is_small| is ture. Otherwise, returns large resolution custom wallpaper |
| + // path. |
| FilePath GetWallpaperPathForUser(const std::string& username, |
| - bool is_thumbnail); |
| + bool is_small); |
| // Gets the thumbnail of custom wallpaper from cache. |
| gfx::ImageSkia GetCustomWallpaperThumbnail(const std::string& email); |
| @@ -183,6 +189,11 @@ class WallpaperManager: public system::TimezoneSettings::Observer, |
| base::WeakPtr<WallpaperDelegate> delegate, |
| const gfx::ImageSkia& wallpaper); |
| + // Gets |email|'s custom wallpaper in appropriate resolution. Falls back on |
| + // original custom wallpaper if failed. Must be executed on FILE thread. |
|
Ivan Korotkov
2012/08/28 16:16:13
'if failed' not necessary here
s/executed/run/
bshe
2012/08/29 14:30:07
Done.
|
| + void GetCustomWallpaperInternal(const std::string& email, |
| + const WallpaperInfo& info); |
| + |
| // Gets wallpaper information of |email| from Local State or memory. Returns |
| // false if wallpaper information is not found. |
| bool GetUserWallpaperInfo(const std::string& email, WallpaperInfo* info); |
| @@ -202,19 +213,36 @@ class WallpaperManager: public system::TimezoneSettings::Observer, |
| // Updates the custom wallpaper thumbnail in wallpaper picker UI. |
| void OnThumbnailUpdated(base::WeakPtr<WallpaperDelegate> delegate); |
| - // Saves wallpaper to |path| (absolute path) in file system. |
| - void SaveWallpaper(const FilePath& path, const UserImage& wallpaper); |
| + // Saves encoded wallpaper to |path|. |
|
Ivan Korotkov
2012/08/28 16:16:13
Please document that this is a callback after enco
bshe
2012/08/29 14:30:07
Done.
|
| + void OnWallpaperEncoded(const FilePath& path, |
| + scoped_refptr<base::RefCountedBytes> data); |
| + |
| + // Resizes |wallpaper| to a resolution which nearest to |preferred_width| and |
|
Ivan Korotkov
2012/08/28 16:16:13
which is
bshe
2012/08/29 14:30:07
Done.
|
| + // |preferred_height| while maintain aspect ratio. And saves the resized |
|
Ivan Korotkov
2012/08/28 16:16:13
maintaining
bshe
2012/08/29 14:30:07
Done.
|
| + // wallpaper to |path|. |
| + void ResizeAndSaveCustomWallpaper(const UserImage& wallpaper, |
| + const FilePath& path, |
| + ash::WallpaperLayout layout, |
| + int preferred_width, |
| + int preferred_height); |
| + |
| + // Saves original custom wallpaper to |path| (absolute path) in file system |
|
Ivan Korotkov
2012/08/28 16:16:13
on filesystem
bshe
2012/08/29 14:30:07
Done.
|
| + // and starts to resize the custom wallpaper if necessary. |
|
Ivan Korotkov
2012/08/28 16:16:13
starts resizing operation of
bshe
2012/08/29 14:30:07
Done.
|
| + void SaveCustomWallpaper(const std::string& email, |
| + const FilePath& path, |
| + ash::WallpaperLayout layout, |
| + const UserImage& wallpaper); |
| // Saves wallpaper image raw |data| to |path| (absolute path) in file system. |
| void SaveWallpaperInternal(const FilePath& path, const char* data, int size); |
| - // Saves wallpaper to file, post task to generate thumbnail and updates local |
| - // state preferences. |
| - void SetWallpaper(const std::string& username, |
| - ash::WallpaperLayout layout, |
| - User::WallpaperType type, |
| - base::WeakPtr<WallpaperDelegate> delegate, |
| - const UserImage& wallpaper); |
| + // Saves custom wallpaper to file, post task to generate thumbnail and updates |
| + // local state preferences. |
| + void SetCustomWallpaper(const std::string& username, |
| + ash::WallpaperLayout layout, |
| + User::WallpaperType type, |
| + base::WeakPtr<WallpaperDelegate> delegate, |
| + const UserImage& wallpaper); |
| // Whether wallpaper data should be persisted for user |email|. |
| // Note: this function can not be called in SetUserWallpaperProperties. It |