Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 // Returns true if the desktop moved. | 128 // Returns true if the desktop moved. |
| 129 bool MoveDesktopToLockedContainer(); | 129 bool MoveDesktopToLockedContainer(); |
| 130 | 130 |
| 131 // Move all desktop widgets to unlocked container. | 131 // Move all desktop widgets to unlocked container. |
| 132 // Returns true if the desktop moved. | 132 // Returns true if the desktop moved. |
| 133 bool MoveDesktopToUnlockedContainer(); | 133 bool MoveDesktopToUnlockedContainer(); |
| 134 | 134 |
| 135 // Overrides DisplayController::Observer: | 135 // Overrides DisplayController::Observer: |
| 136 virtual void OnDisplayConfigurationChanged() OVERRIDE; | 136 virtual void OnDisplayConfigurationChanged() OVERRIDE; |
| 137 | 137 |
| 138 // Use given files as default wallpaper. | |
| 139 void SetDefaultWallpaperPath( | |
|
Daniel Erat
2014/03/24 16:25:48
nit: move this above the overridden method (also i
Alexander Alekseev
2014/03/24 17:33:43
Done.
| |
| 140 const base::FilePath& customized_default_wallpaper_file_small, | |
|
Daniel Erat
2014/03/24 16:25:48
nit: mind removing the word "customized" from thes
Alexander Alekseev
2014/03/24 17:33:43
Done.
| |
| 141 const base::FilePath& customized_default_wallpaper_file_large); | |
| 142 | |
| 138 private: | 143 private: |
| 139 friend class DesktopBackgroundControllerTest; | 144 friend class DesktopBackgroundControllerTest; |
| 140 FRIEND_TEST_ALL_PREFIXES(DesktopBackgroundControllerTest, GetMaxDisplaySize); | 145 FRIEND_TEST_ALL_PREFIXES(DesktopBackgroundControllerTest, GetMaxDisplaySize); |
| 141 | 146 |
| 142 // An operation to asynchronously loads wallpaper. | 147 // An operation to asynchronously loads wallpaper. |
| 143 class WallpaperLoader; | 148 class WallpaperLoader; |
| 144 | 149 |
| 145 // Returns true if the specified default wallpaper is already being | 150 // Returns true if the specified default wallpaper is already being |
| 146 // loaded by |wallpaper_loader_| or stored in |current_wallpaper_|. | 151 // loaded by |wallpaper_loader_| or stored in |current_wallpaper_|. |
| 152 // (i.e. no need to reload if exacltly duplicate request received) | |
|
Daniel Erat
2014/03/24 16:25:48
nit: s/exacltly/exactly/
Alexander Alekseev
2014/03/24 17:33:43
Done.
| |
| 147 bool DefaultWallpaperIsAlreadyLoadingOrLoaded( | 153 bool DefaultWallpaperIsAlreadyLoadingOrLoaded( |
| 148 const base::FilePath& image_file, int image_resource_id) const; | 154 const base::FilePath& image_file, int image_resource_id) const; |
| 149 | 155 |
| 156 // Returns true if the specified default wallpaper file is already being | |
| 157 // loaded |wallpaper_loader_| or stored in |current_wallpaper_|. | |
| 158 // (i.e. if current wallpaper is "default" and we need to replace the default | |
| 159 // wallpaper with another file, we need to initiate SetDefaultWallpaper() ) | |
| 160 bool DefaultWallpaperFileIsAlreadyLoadingOrLoaded( | |
| 161 const base::FilePath& image_file) const; | |
| 162 | |
| 150 // Returns true if the specified custom wallpaper is already stored | 163 // Returns true if the specified custom wallpaper is already stored |
| 151 // in |current_wallpaper_|. | 164 // in |current_wallpaper_|. |
| 152 bool CustomWallpaperIsAlreadyLoaded(const gfx::ImageSkia& image) const; | 165 bool CustomWallpaperIsAlreadyLoaded(const gfx::ImageSkia& image) const; |
| 153 | 166 |
| 154 // Creates view for all root windows, or notifies them to repaint if they | 167 // Creates view for all root windows, or notifies them to repaint if they |
| 155 // already exist. | 168 // already exist. |
| 156 void SetDesktopBackgroundImageMode(); | 169 void SetDesktopBackgroundImageMode(); |
| 157 | 170 |
| 158 // Creates a new background widget and sets the background mode to image mode. | 171 // Creates a new background widget and sets the background mode to image mode. |
| 159 // Called after a default wallpaper has been loaded successfully. | 172 // Called after a default wallpaper has been loaded successfully. |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 183 void set_wallpaper_reload_delay_for_test(bool value) { | 196 void set_wallpaper_reload_delay_for_test(bool value) { |
| 184 wallpaper_reload_delay_ = value; | 197 wallpaper_reload_delay_ = value; |
| 185 } | 198 } |
| 186 | 199 |
| 187 // Returns the maximum size of all displays combined in native | 200 // Returns the maximum size of all displays combined in native |
| 188 // resolutions. Note that this isn't the bounds of the display who | 201 // resolutions. Note that this isn't the bounds of the display who |
| 189 // has maximum resolutions. Instead, this returns the size of the | 202 // has maximum resolutions. Instead, this returns the size of the |
| 190 // maximum width of all displays, and the maximum height of all displays. | 203 // maximum width of all displays, and the maximum height of all displays. |
| 191 static gfx::Size GetMaxDisplaySizeInNative(); | 204 static gfx::Size GetMaxDisplaySizeInNative(); |
| 192 | 205 |
| 206 // SetDefaultWallpaper using given path and mode. | |
| 207 bool DoSetDefaultWallpaper(const base::FilePath& file_path, | |
| 208 const bool use_large); | |
| 209 | |
| 210 // Before setting first wallpaper we need to check and probably apply | |
| 211 // device customization. | |
| 212 void CheckForCustomization(); | |
| 213 | |
| 193 // If non-NULL, used in place of the real command line. | 214 // If non-NULL, used in place of the real command line. |
| 194 base::CommandLine* command_line_for_testing_; | 215 base::CommandLine* command_line_for_testing_; |
| 195 | 216 |
| 196 // Can change at runtime. | 217 // Can change at runtime. |
| 197 bool locked_; | 218 bool locked_; |
| 198 | 219 |
| 199 BackgroundMode desktop_background_mode_; | 220 BackgroundMode desktop_background_mode_; |
| 200 | 221 |
| 201 SkColor background_color_; | 222 SkColor background_color_; |
| 202 | 223 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 215 | 236 |
| 216 // Loads default wallpaper from disk. | 237 // Loads default wallpaper from disk. |
| 217 scoped_refptr<WallpaperLoader> default_wallpaper_loader_; | 238 scoped_refptr<WallpaperLoader> default_wallpaper_loader_; |
| 218 | 239 |
| 219 base::WeakPtrFactory<DesktopBackgroundController> weak_ptr_factory_; | 240 base::WeakPtrFactory<DesktopBackgroundController> weak_ptr_factory_; |
| 220 | 241 |
| 221 base::OneShotTimer<DesktopBackgroundController> timer_; | 242 base::OneShotTimer<DesktopBackgroundController> timer_; |
| 222 | 243 |
| 223 int wallpaper_reload_delay_; | 244 int wallpaper_reload_delay_; |
| 224 | 245 |
| 246 base::FilePath customized_default_wallpaper_file_small_; | |
| 247 base::FilePath customized_default_wallpaper_file_large_; | |
| 248 | |
| 249 bool customization_applied_; | |
| 250 | |
| 225 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); | 251 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); |
| 226 }; | 252 }; |
| 227 | 253 |
| 228 } // namespace ash | 254 } // namespace ash |
| 229 | 255 |
| 230 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ | 256 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ |
| OLD | NEW |