Chromium Code Reviews| Index: ash/desktop_background/desktop_background_controller.h |
| diff --git a/ash/desktop_background/desktop_background_controller.h b/ash/desktop_background/desktop_background_controller.h |
| index 505f7441792b86584a009f06becf2453195119f0..daf77d0ba2b8fca371589d1f014143e888b247ec 100644 |
| --- a/ash/desktop_background/desktop_background_controller.h |
| +++ b/ash/desktop_background/desktop_background_controller.h |
| @@ -23,8 +23,8 @@ namespace aura { |
| class Window; |
| } |
| -namespace base { |
| -class CommandLine; |
| +namespace chromeos { |
| +class WallpaperManagerBrowserTestDefaultWallpaper; |
| } |
| namespace ash { |
| @@ -43,26 +43,8 @@ enum WallpaperLayout { |
| WALLPAPER_LAYOUT_TILE, |
| }; |
| -enum WallpaperResolution { |
| - WALLPAPER_RESOLUTION_LARGE, |
| - WALLPAPER_RESOLUTION_SMALL |
| -}; |
| - |
| const SkColor kLoginWallpaperColor = 0xFEFEFE; |
| -// The width and height of small/large resolution wallpaper. When screen size is |
| -// smaller than |kSmallWallpaperMaxWidth| and |kSmallWallpaperMaxHeight|, the |
| -// small resolution wallpaper should be used. Otherwise, uses the large |
| -// resolution wallpaper. |
| -ASH_EXPORT extern const int kSmallWallpaperMaxWidth; |
| -ASH_EXPORT extern const int kSmallWallpaperMaxHeight; |
| -ASH_EXPORT extern const int kLargeWallpaperMaxWidth; |
| -ASH_EXPORT extern const int kLargeWallpaperMaxHeight; |
| - |
| -// The width and heigh of wallpaper thumbnails. |
| -ASH_EXPORT extern const int kWallpaperThumbnailWidth; |
| -ASH_EXPORT extern const int kWallpaperThumbnailHeight; |
| - |
| class DesktopBackgroundControllerObserver; |
| class WallpaperResizer; |
| @@ -83,10 +65,6 @@ class ASH_EXPORT DesktopBackgroundController |
| return desktop_background_mode_; |
| } |
| - void set_command_line_for_testing(base::CommandLine* command_line) { |
| - command_line_for_testing_ = command_line; |
| - } |
| - |
| // Add/Remove observers. |
| void AddObserver(DesktopBackgroundControllerObserver* observer); |
| void RemoveObserver(DesktopBackgroundControllerObserver* observer); |
| @@ -100,18 +78,13 @@ class ASH_EXPORT DesktopBackgroundController |
| // Initialize root window's background. |
| void OnRootWindowAdded(aura::Window* root_window); |
| - // Loads builtin wallpaper asynchronously and sets to current wallpaper |
| - // after loaded. Returns true if the controller started loading the |
| - // wallpaper and false otherwise (i.e. the appropriate wallpaper was |
| - // already loading or loaded). |
| - bool SetDefaultWallpaper(bool is_guest); |
| - |
| - // Sets the user selected custom wallpaper. Called when user selected a file |
| - // from file system or changed the layout of wallpaper. |
| - void SetCustomWallpaper(const gfx::ImageSkia& image, WallpaperLayout layout); |
| - |
| - // Cancels |default_wallpaper_loader_| if non-NULL. |
| - void CancelDefaultWallpaperLoader(); |
| + // Sets wallpaper. This is mostly called by WallpaperManager to set |
| + // the default or user selected custom wallpaper. |
| + // Returns true if new image was actually set. And false when duplicate set |
| + // request detected. |
| + bool SetWallpaper(const gfx::ImageSkia& image, WallpaperLayout layout); |
| + // The same, but image from resources is used. |
| + bool SetWallpaper(int resource_id, WallpaperLayout layout); |
|
Daniel Erat
2014/04/04 02:45:49
i'm not sure that we still need to support resourc
Alexander Alekseev
2014/04/05 03:35:13
Done.
|
| // Creates an empty wallpaper. Some tests require a wallpaper widget is ready |
| // when running. However, the wallpaper widgets are now created |
| @@ -121,9 +94,6 @@ class ASH_EXPORT DesktopBackgroundController |
| // crashes. An example test is SystemGestureEventFilterTest.ThreeFingerSwipe. |
| void CreateEmptyWallpaper(); |
| - // Returns the appropriate wallpaper resolution for all root windows. |
| - WallpaperResolution GetAppropriateResolution(); |
| - |
| // Move all desktop widgets to locked container. |
| // Returns true if the desktop moved. |
| bool MoveDesktopToLockedContainer(); |
| @@ -135,30 +105,28 @@ class ASH_EXPORT DesktopBackgroundController |
| // Overrides DisplayController::Observer: |
| virtual void OnDisplayConfigurationChanged() OVERRIDE; |
| + // Returns the maximum size of all displays combined in native |
| + // resolutions. Note that this isn't the bounds of the display who |
| + // has maximum resolutions. Instead, this returns the size of the |
| + // maximum width of all displays, and the maximum height of all displays. |
| + static gfx::Size GetMaxDisplaySizeInNative(); |
| + |
| private: |
| friend class DesktopBackgroundControllerTest; |
| + friend class chromeos::WallpaperManagerBrowserTestDefaultWallpaper; |
| FRIEND_TEST_ALL_PREFIXES(DesktopBackgroundControllerTest, GetMaxDisplaySize); |
| - // An operation to asynchronously loads wallpaper. |
| - class WallpaperLoader; |
| - |
| - // Returns true if the specified default wallpaper is already being |
| - // loaded by |wallpaper_loader_| or stored in |current_wallpaper_|. |
| - bool DefaultWallpaperIsAlreadyLoadingOrLoaded( |
| - const base::FilePath& image_file, int image_resource_id) const; |
| - |
| - // Returns true if the specified custom wallpaper is already stored |
| + // Returns true if the specified wallpaper is already stored |
| // in |current_wallpaper_|. |
| - bool CustomWallpaperIsAlreadyLoaded(const gfx::ImageSkia& image) const; |
| + // If |image| is NULL, resource_id is compared. |
| + bool WallpaperIsAlreadyLoaded(const gfx::ImageSkia* image, |
| + int resource_id, |
| + WallpaperLayout layout) const; |
| // Creates view for all root windows, or notifies them to repaint if they |
| // already exist. |
| void SetDesktopBackgroundImageMode(); |
| - // Creates a new background widget and sets the background mode to image mode. |
| - // Called after a default wallpaper has been loaded successfully. |
| - void OnDefaultWallpaperLoadCompleted(scoped_refptr<WallpaperLoader> loader); |
| - |
| // Creates and adds component for current mode (either Widget or Layer) to |
| // |root_window|. |
| void InstallDesktopController(aura::Window* root_window); |
| @@ -184,15 +152,6 @@ class ASH_EXPORT DesktopBackgroundController |
| wallpaper_reload_delay_ = value; |
| } |
| - // Returns the maximum size of all displays combined in native |
| - // resolutions. Note that this isn't the bounds of the display who |
| - // has maximum resolutions. Instead, this returns the size of the |
| - // maximum width of all displays, and the maximum height of all displays. |
| - static gfx::Size GetMaxDisplaySizeInNative(); |
| - |
| - // If non-NULL, used in place of the real command line. |
| - base::CommandLine* command_line_for_testing_; |
| - |
| // Can change at runtime. |
| bool locked_; |
| @@ -205,19 +164,8 @@ class ASH_EXPORT DesktopBackgroundController |
| // The current wallpaper. |
| scoped_ptr<WallpaperResizer> current_wallpaper_; |
| - // If a default wallpaper is stored in |current_wallpaper_|, the path and |
| - // resource ID that were passed to WallpaperLoader when loading it. |
| - // Otherwise, empty and -1, respectively. |
| - base::FilePath current_default_wallpaper_path_; |
| - int current_default_wallpaper_resource_id_; |
| - |
| gfx::Size current_max_display_size_; |
| - // Loads default wallpaper from disk. |
| - scoped_refptr<WallpaperLoader> default_wallpaper_loader_; |
| - |
| - base::WeakPtrFactory<DesktopBackgroundController> weak_ptr_factory_; |
| - |
| base::OneShotTimer<DesktopBackgroundController> timer_; |
| int wallpaper_reload_delay_; |