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

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

Issue 215293003: Move all wallpaper file loading and decoding from DesktopBackgroundController to WallpaperManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix windows build. Created 6 years, 9 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 203e35f7c5789acdc4d9ca6bb756cbd43418a3a8..0cd5bd0472ab36448e8591fe741374755888e699 100644
--- a/chrome/browser/chromeos/login/wallpaper_manager.h
+++ b/chrome/browser/chromeos/login/wallpaper_manager.h
@@ -171,9 +171,7 @@ class WallpaperManager: public content::NotificationObserver {
WallpaperManager();
virtual ~WallpaperManager();
- void set_command_line_for_testing(base::CommandLine* command_line) {
- command_line_for_testing_ = command_line;
- }
+ void set_command_line_for_testing(base::CommandLine* command_line);
// Indicates imminent shutdown, allowing the WallpaperManager to remove any
// observers it has registered.
@@ -224,16 +222,19 @@ class WallpaperManager: public content::NotificationObserver {
ash::WallpaperLayout layout,
int preferred_width,
int preferred_height,
- scoped_refptr<base::RefCountedBytes>* output) const;
+ scoped_refptr<base::RefCountedBytes>* output,
+ gfx::ImageSkia* output_skia) const;
// Resizes |wallpaper| to a resolution which is nearest to |preferred_width|
// and |preferred_height| while maintaining aspect ratio. And saves the
- // resized wallpaper to |path|.
- void ResizeAndSaveWallpaper(const UserImage& wallpaper,
+ // resized wallpaper to |path|. |result| is optional (may be NULL).
+ // Result is true on success.
Daniel Erat 2014/03/31 22:25:46 nit: change to "Returns true on success."
Alexander Alekseev 2014/04/03 19:15:44 Done.
+ bool ResizeAndSaveWallpaper(const UserImage& wallpaper,
const base::FilePath& path,
ash::WallpaperLayout layout,
int preferred_width,
- int preferred_height) const;
+ int preferred_height,
+ gfx::ImageSkia* result) const;
// Saves custom wallpaper to file, post task to generate thumbnail and updates
// local state preferences. If |update_wallpaper| is false, don't change
@@ -309,6 +310,7 @@ class WallpaperManager: public content::NotificationObserver {
friend class TestApi;
friend class WallpaperManagerBrowserTest;
friend class WallpaperManagerPolicyTest;
+ friend class WallpaperManagerTest;
typedef std::map<std::string, gfx::ImageSkia> CustomWallpaperMap;
@@ -427,7 +429,9 @@ class WallpaperManager: public content::NotificationObserver {
const UserImage& wallpaper);
// Saves wallpaper image raw |data| to |path| (absolute path) in file system.
- void SaveWallpaperInternal(const base::FilePath& path, const char* data,
+ // True on success.
+ bool SaveWallpaperInternal(const base::FilePath& path,
+ const char* data,
int size) const;
// Creates new PendingWallpaper request (or updates currently pending).
@@ -464,6 +468,21 @@ class WallpaperManager: public content::NotificationObserver {
// in zero delay.
base::TimeDelta GetWallpaperLoadDelay() const;
+ // Init "*default_*_wallpaper_file_" from given command line.
+ void SetDefaultWallpaperPathFromCommandLine(base::CommandLine* command_line);
Daniel Erat 2014/03/31 22:25:46 nit: s/Path/Paths/
Alexander Alekseev 2014/04/03 19:15:44 Done.
+
+ // Sets wallpaper to decoded default.
+ void OnDefaultWallpaperDecoded(const base::FilePath& path,
+ scoped_ptr<gfx::ImageSkia>* result,
+ MovableOnDestroyCallbackHolder on_finish,
+ const UserImage& wallpaper);
bshe 2014/04/01 15:32:56 nit: parameters that output result should appears
Alexander Alekseev 2014/04/03 19:15:44 OnDefaultWallpaperDecoded is used to create callba
+
+ // Start decoding given default wallpaper.
+ void StartLoadAndSetDefaultWallpaper(
+ const base::FilePath& path,
+ scoped_ptr<gfx::ImageSkia>* result,
+ MovableOnDestroyCallbackHolder on_finish);
+
// The number of loaded wallpapers.
int loaded_wallpapers_;
@@ -520,6 +539,18 @@ class WallpaperManager: public content::NotificationObserver {
typedef std::vector<scoped_refptr<PendingWallpaper> > PendingList;
PendingList loading_;
+ base::FilePath default_small_wallpaper_file_;
+ base::FilePath default_large_wallpaper_file_;
+
+ base::FilePath guest_default_small_wallpaper_file_;
Daniel Erat 2014/03/31 22:25:46 mind renaming these to "guest_small_wallpaper_file
Alexander Alekseev 2014/04/03 19:15:44 Done.
+ base::FilePath guest_default_large_wallpaper_file_;
+
+ // Decoded default images are stored here.
+ scoped_ptr<gfx::ImageSkia> default_small_wallpaper_image_;
Daniel Erat 2014/03/31 22:25:46 i'm pretty sure we don't want to hold all of these
bshe 2014/04/01 15:32:56 +1 On 2014/03/31 22:25:46, Daniel Erat wrote:
Alexander Alekseev 2014/04/03 19:15:44 Done.
+ scoped_ptr<gfx::ImageSkia> default_large_wallpaper_image_;
+ scoped_ptr<gfx::ImageSkia> guest_default_small_wallpaper_image_;
+ scoped_ptr<gfx::ImageSkia> guest_default_large_wallpaper_image_;
+
DISALLOW_COPY_AND_ASSIGN(WallpaperManager);
};

Powered by Google App Engine
This is Rietveld 408576698