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 aed11eb96a21c8c064af59a89bea9d2af593a822..16895aed8677d7689bec5d50efddbc5b8ef2abf9 100644 |
--- a/chrome/browser/chromeos/login/wallpaper_manager.h |
+++ b/chrome/browser/chromeos/login/wallpaper_manager.h |
@@ -72,6 +72,9 @@ extern const char kThumbnailWallpaperSubDir[]; |
// OS device. |
class WallpaperManager: public content::NotificationObserver { |
public: |
+ class CustomizedWallpaperRescaledFiles; |
+ class CustomizedWallpaperFilesExist; |
+ |
// For testing. |
class TestApi { |
public: |
@@ -229,7 +232,8 @@ class WallpaperManager: public content::NotificationObserver { |
// 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, |
+ // Result is true on success. |
+ bool ResizeAndSaveWallpaper(const UserImage& wallpaper, |
const base::FilePath& path, |
ash::WallpaperLayout layout, |
int preferred_width, |
@@ -305,6 +309,23 @@ class WallpaperManager: public content::NotificationObserver { |
const std::string& user_id, |
scoped_ptr<std::string> data); |
+ // This is called from CustomizationDocument. |
+ // scaled_directory - directory where resized versions are stored |
+ // (must be writable) |
+ void SetCustomizedDefaultWallpaper(const GURL& wallpaper_url, |
+ const base::FilePath& downloaded_file, |
+ const base::FilePath& resized_directory); |
+ |
+ // These global default values are used to init customized default |
+ // wallpaper in Desktop Background Controller before first wallpaper was |
+ // shown. |
+ static base::FilePath GetCustomizedWallpaperDefaultRescaledSmallFileName(); |
+ static base::FilePath GetCustomizedWallpaperDefaultRescaledLargeFileName(); |
+ |
+ // If DesktopBackgroundController should start with customized default |
+ // wallpaper. |
+ static bool ShouldUseCustomizedDefaultWallpaper(); |
+ |
private: |
friend class TestApi; |
friend class WallpaperManagerBrowserTest; |
@@ -425,7 +446,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). |
@@ -462,6 +485,33 @@ class WallpaperManager: public content::NotificationObserver { |
// in zero delay. |
base::TimeDelta GetWallpaperLoadDelay() const; |
+ // This is called after we check that supplied default wallpaper files exist. |
+ void SetCustomizedDefaultWallpaperAfterCheck( |
+ const GURL& wallpaper_url, |
+ const base::FilePath& downloaded_file, |
+ scoped_ptr<CustomizedWallpaperRescaledFiles> rescaled_files, |
+ scoped_ptr<CustomizedWallpaperFilesExist> exist); |
+ |
+ // Starts rescaling of customized wallpaper. |
+ void OnCustomizedDefaultWallpaperDecoded( |
+ const GURL& wallpaper_url, |
+ scoped_ptr<CustomizedWallpaperRescaledFiles> rescaled_files, |
+ const UserImage& user_image); |
+ |
+ // Resize and save customized default wallpaper. |
+ void ResizeCustomizedDefaultWallpaper( |
+ scoped_ptr<gfx::ImageSkia> image, |
+ const UserImage::RawImage& raw_image, |
+ const CustomizedWallpaperRescaledFiles* rescaled_files, |
+ bool* success); |
+ |
+ // Check the result of ResizeCustomizedDefaultWallpaper and finally |
+ // apply Customized Default Wallpaper. |
+ void OnCustomizedDefaultWallpaperResized( |
+ const GURL& wallpaper_url, |
+ scoped_ptr<CustomizedWallpaperRescaledFiles> rescaled_files, |
+ scoped_ptr<bool> success); |
+ |
// The number of loaded wallpapers. |
int loaded_wallpapers_; |