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

Side by Side Diff: ash/desktop_background/desktop_background_controller.h

Issue 236013002: Apply default wallpaper from customization manifest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove wallpaper URL from ServicesCustomizationDocumentTest. Created 6 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ 5 #ifndef ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_
6 #define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ 6 #define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/display/display_controller.h" 9 #include "ash/display/display_controller.h"
10 #include "ash/shell_observer.h" 10 #include "ash/shell_observer.h"
(...skipping 19 matching lines...) Expand all
30 // Center the wallpaper on the desktop without scaling it. The wallpaper 30 // Center the wallpaper on the desktop without scaling it. The wallpaper
31 // may be cropped. 31 // may be cropped.
32 WALLPAPER_LAYOUT_CENTER, 32 WALLPAPER_LAYOUT_CENTER,
33 // Scale the wallpaper (while preserving its aspect ratio) to cover the 33 // Scale the wallpaper (while preserving its aspect ratio) to cover the
34 // desktop; the wallpaper may be cropped. 34 // desktop; the wallpaper may be cropped.
35 WALLPAPER_LAYOUT_CENTER_CROPPED, 35 WALLPAPER_LAYOUT_CENTER_CROPPED,
36 // Scale the wallpaper (without preserving its aspect ratio) to match the 36 // Scale the wallpaper (without preserving its aspect ratio) to match the
37 // desktop's size. 37 // desktop's size.
38 WALLPAPER_LAYOUT_STRETCH, 38 WALLPAPER_LAYOUT_STRETCH,
39 // Tile the wallpaper over the background without scaling it. 39 // Tile the wallpaper over the background without scaling it.
40 WALLPAPER_LAYOUT_TILE, 40 WALLPAPER_LAYOUT_TILE
41 }; 41 };
42 42
43 const SkColor kLoginWallpaperColor = 0xFEFEFE; 43 const SkColor kLoginWallpaperColor = 0xFEFEFE;
44 44
45 class DesktopBackgroundControllerObserver; 45 class DesktopBackgroundControllerObserver;
46 class WallpaperResizer; 46 class WallpaperResizer;
47 47
48 // Updates background layer if necessary. 48 // Updates background layer if necessary.
49 class ASH_EXPORT DesktopBackgroundController 49 class ASH_EXPORT DesktopBackgroundController
50 : public DisplayController::Observer, 50 : public DisplayController::Observer,
51 public ShellObserver { 51 public ShellObserver {
52 public: 52 public:
53 class TestAPI; 53 class TestAPI;
54 54
55 enum BackgroundMode { 55 enum BackgroundMode {
56 BACKGROUND_NONE, 56 BACKGROUND_NONE,
57 BACKGROUND_IMAGE, 57 BACKGROUND_IMAGE,
58 }; 58 };
59 59
60 // This is used to initialize Resource ID variables and to denote "no
61 // resource ID" in parameters.
62 static const int kInvalidResourceID;
63
60 DesktopBackgroundController(); 64 DesktopBackgroundController();
61 virtual ~DesktopBackgroundController(); 65 virtual ~DesktopBackgroundController();
62 66
63 BackgroundMode desktop_background_mode() const { 67 BackgroundMode desktop_background_mode() const {
64 return desktop_background_mode_; 68 return desktop_background_mode_;
65 } 69 }
66 70
67 // Add/Remove observers. 71 // Add/Remove observers.
68 void AddObserver(DesktopBackgroundControllerObserver* observer); 72 void AddObserver(DesktopBackgroundControllerObserver* observer);
69 void RemoveObserver(DesktopBackgroundControllerObserver* observer); 73 void RemoveObserver(DesktopBackgroundControllerObserver* observer);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 107
104 // ShellObserver: 108 // ShellObserver:
105 virtual void OnRootWindowAdded(aura::Window* root_window) OVERRIDE; 109 virtual void OnRootWindowAdded(aura::Window* root_window) OVERRIDE;
106 110
107 // Returns the maximum size of all displays combined in native 111 // Returns the maximum size of all displays combined in native
108 // resolutions. Note that this isn't the bounds of the display who 112 // resolutions. Note that this isn't the bounds of the display who
109 // has maximum resolutions. Instead, this returns the size of the 113 // has maximum resolutions. Instead, this returns the size of the
110 // maximum width of all displays, and the maximum height of all displays. 114 // maximum width of all displays, and the maximum height of all displays.
111 static gfx::Size GetMaxDisplaySizeInNative(); 115 static gfx::Size GetMaxDisplaySizeInNative();
112 116
117 // Returns true if the specified wallpaper is already stored
118 // in |current_wallpaper_|.
119 // If |image| is NULL, resource_id is compared.
120 // If |compare_layouts| is false, layout is ignored.
121 bool WallpaperIsAlreadyLoaded(const gfx::ImageSkia* image,
122 int resource_id,
123 bool compare_layouts,
124 WallpaperLayout layout) const;
125
113 private: 126 private:
114 friend class DesktopBackgroundControllerTest; 127 friend class DesktopBackgroundControllerTest;
115 // friend class chromeos::WallpaperManagerBrowserTestDefaultWallpaper; 128 // friend class chromeos::WallpaperManagerBrowserTestDefaultWallpaper;
116 FRIEND_TEST_ALL_PREFIXES(DesktopBackgroundControllerTest, GetMaxDisplaySize); 129 FRIEND_TEST_ALL_PREFIXES(DesktopBackgroundControllerTest, GetMaxDisplaySize);
117 130
118 // Returns true if the specified wallpaper is already stored
119 // in |current_wallpaper_|.
120 // If |image| is NULL, resource_id is compared.
121 bool WallpaperIsAlreadyLoaded(const gfx::ImageSkia* image,
122 int resource_id,
123 WallpaperLayout layout) const;
124
125 // Creates view for all root windows, or notifies them to repaint if they 131 // Creates view for all root windows, or notifies them to repaint if they
126 // already exist. 132 // already exist.
127 void SetDesktopBackgroundImageMode(); 133 void SetDesktopBackgroundImageMode();
128 134
129 // Creates and adds component for current mode (either Widget or Layer) to 135 // Creates and adds component for current mode (either Widget or Layer) to
130 // |root_window|. 136 // |root_window|.
131 void InstallDesktopController(aura::Window* root_window); 137 void InstallDesktopController(aura::Window* root_window);
132 138
133 // Creates and adds component for current mode (either Widget or Layer) to 139 // Creates and adds component for current mode (either Widget or Layer) to
134 // all root windows. 140 // all root windows.
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 base::OneShotTimer<DesktopBackgroundController> timer_; 174 base::OneShotTimer<DesktopBackgroundController> timer_;
169 175
170 int wallpaper_reload_delay_; 176 int wallpaper_reload_delay_;
171 177
172 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); 178 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController);
173 }; 179 };
174 180
175 } // namespace ash 181 } // namespace ash
176 182
177 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ 183 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698