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

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

Issue 208273005: If customization includes default wallpaper, download and apply it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 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_;

Powered by Google App Engine
This is Rietveld 408576698