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

Unified Diff: ash/desktop_background/desktop_background_controller.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: 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..9a3f0c532a22029b2a1e60d51c1e3a9683f437dd 100644
--- a/ash/desktop_background/desktop_background_controller.h
+++ b/ash/desktop_background/desktop_background_controller.h
@@ -23,10 +23,6 @@ namespace aura {
class Window;
}
-namespace base {
-class CommandLine;
-}
-
namespace ash {
enum WallpaperLayout {
@@ -83,10 +79,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 +92,9 @@ 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.
+ void SetWallpaper(const gfx::ImageSkia& image, WallpaperLayout layout);
// Creates an empty wallpaper. Some tests require a wallpaper widget is ready
// when running. However, the wallpaper widgets are now created
@@ -135,30 +118,18 @@ class ASH_EXPORT DesktopBackgroundController
// Overrides DisplayController::Observer:
virtual void OnDisplayConfigurationChanged() OVERRIDE;
+ // Returns true if the specified wallpaper is already stored
+ // in |current_wallpaper_|.
+ bool WallpaperIsAlreadyLoaded(const gfx::ImageSkia& image) const;
+
private:
friend class DesktopBackgroundControllerTest;
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
- // in |current_wallpaper_|.
- bool CustomWallpaperIsAlreadyLoaded(const gfx::ImageSkia& image) 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);
@@ -190,9 +161,6 @@ class ASH_EXPORT DesktopBackgroundController
// 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 +173,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_;

Powered by Google App Engine
This is Rietveld 408576698