| 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..d7da637820aab5aa523f5c88273411e1cdf0c1d3 100644
|
| --- a/chrome/browser/chromeos/login/wallpaper_manager.h
|
| +++ b/chrome/browser/chromeos/login/wallpaper_manager.h
|
| @@ -90,6 +90,24 @@ class WallpaperManager: public content::NotificationObserver {
|
| WALLPAPER_RESOLUTION_SMALL
|
| };
|
|
|
| + struct CustomizedWallpaperRescaledFiles {
|
| + CustomizedWallpaperRescaledFiles(const base::FilePath& path_rescaled_small,
|
| + const base::FilePath& path_rescaled_large);
|
| +
|
| + base::FilePath path_rescaled_small;
|
| + base::FilePath path_rescaled_large;
|
| + };
|
| +
|
| + struct CustomizedWallpaperFilesExist {
|
| + CustomizedWallpaperFilesExist();
|
| +
|
| + bool AllRescaledExist() const;
|
| +
|
| + bool downloaded;
|
| + bool rescaled_small;
|
| + bool rescaled_large;
|
| + };
|
| +
|
| // For testing.
|
| class TestApi {
|
| public:
|
| @@ -266,6 +284,17 @@ class WallpaperManager: public content::NotificationObserver {
|
| const UserImage& wallpaper,
|
| bool update_wallpaper);
|
|
|
| + // Use given files as new default wallpaper.
|
| + // Reloads current wallpaper, if old default was loaded.
|
| + // Current value of default_wallpaper_image_ is destroyed.
|
| + // Sets default_wallpaper_image_ either to |small_wallpaper_image| or
|
| + // |large_wallpaper_image| depending on GetAppropriateResolution().
|
| + void SetDefaultWallpaperPath(
|
| + const base::FilePath& customized_default_wallpaper_file_small,
|
| + scoped_ptr<gfx::ImageSkia> small_wallpaper_image,
|
| + const base::FilePath& customized_default_wallpaper_file_large,
|
| + scoped_ptr<gfx::ImageSkia> large_wallpaper_image);
|
| +
|
| // Sets wallpaper to default wallpaper (asynchronously with zero delay).
|
| void SetDefaultWallpaperNow(const std::string& user_id);
|
|
|
| @@ -328,6 +357,13 @@ class WallpaperManager: public content::NotificationObserver {
|
| // Returns the appropriate wallpaper resolution for all root windows.
|
| static WallpaperResolution GetAppropriateResolution();
|
|
|
| + // This is called from CustomizationDocument.
|
| + // resized_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);
|
| +
|
| private:
|
| friend class TestApi;
|
| friend class WallpaperManagerBrowserTest;
|
| @@ -490,6 +526,46 @@ 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,
|
| + gfx::ImageSkia* small_wallpaper_image,
|
| + gfx::ImageSkia* large_wallpaper_image);
|
| +
|
| + // 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,
|
| + scoped_ptr<gfx::ImageSkia> small_wallpaper_image,
|
| + scoped_ptr<gfx::ImageSkia> large_wallpaper_image);
|
| +
|
| + // These global default values are used to set customized default
|
| + // wallpaper path in InitializeWallpaper().
|
| + static base::FilePath GetCustomizedWallpaperDefaultRescaledFileName(
|
| + const char* suffix);
|
| +
|
| + // If DesktopBackgroundController should start with customized default
|
| + // wallpaper in InitializeWallpaper().
|
| + static bool ShouldUseCustomizedDefaultWallpaper();
|
| +
|
| // Init |*default_*_wallpaper_file_| from given command line and
|
| // clear |default_wallpaper_image_|.
|
| void SetDefaultWallpaperPathsFromCommandLine(base::CommandLine* command_line);
|
|
|