| 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" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
| 17 #include "ui/compositor/layer.h" | 17 #include "ui/compositor/layer.h" |
| 18 #include "ui/gfx/image/image_skia.h" | 18 #include "ui/gfx/image/image_skia.h" |
| 19 | 19 |
| 20 typedef unsigned int SkColor; | 20 typedef unsigned int SkColor; |
| 21 | 21 |
| 22 class CommandLine; | |
| 23 | |
| 24 namespace aura { | 22 namespace aura { |
| 25 class Window; | 23 class Window; |
| 26 } | 24 } |
| 27 | 25 |
| 26 namespace base { |
| 27 class CommandLine; |
| 28 } |
| 29 |
| 28 namespace ash { | 30 namespace ash { |
| 29 | 31 |
| 30 enum WallpaperLayout { | 32 enum WallpaperLayout { |
| 31 // Center the wallpaper on the desktop without scaling it. The wallpaper | 33 // Center the wallpaper on the desktop without scaling it. The wallpaper |
| 32 // may be cropped. | 34 // may be cropped. |
| 33 WALLPAPER_LAYOUT_CENTER, | 35 WALLPAPER_LAYOUT_CENTER, |
| 34 // Scale the wallpaper (while preserving its aspect ratio) to cover the | 36 // Scale the wallpaper (while preserving its aspect ratio) to cover the |
| 35 // desktop; the wallpaper may be cropped. | 37 // desktop; the wallpaper may be cropped. |
| 36 WALLPAPER_LAYOUT_CENTER_CROPPED, | 38 WALLPAPER_LAYOUT_CENTER_CROPPED, |
| 37 // Scale the wallpaper (without preserving its aspect ratio) to match the | 39 // Scale the wallpaper (without preserving its aspect ratio) to match the |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 BACKGROUND_IMAGE, | 76 BACKGROUND_IMAGE, |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 DesktopBackgroundController(); | 79 DesktopBackgroundController(); |
| 78 virtual ~DesktopBackgroundController(); | 80 virtual ~DesktopBackgroundController(); |
| 79 | 81 |
| 80 BackgroundMode desktop_background_mode() const { | 82 BackgroundMode desktop_background_mode() const { |
| 81 return desktop_background_mode_; | 83 return desktop_background_mode_; |
| 82 } | 84 } |
| 83 | 85 |
| 84 void set_command_line_for_testing(CommandLine* command_line) { | 86 void set_command_line_for_testing(base::CommandLine* command_line) { |
| 85 command_line_for_testing_ = command_line; | 87 command_line_for_testing_ = command_line; |
| 86 } | 88 } |
| 87 | 89 |
| 88 // Add/Remove observers. | 90 // Add/Remove observers. |
| 89 void AddObserver(DesktopBackgroundControllerObserver* observer); | 91 void AddObserver(DesktopBackgroundControllerObserver* observer); |
| 90 void RemoveObserver(DesktopBackgroundControllerObserver* observer); | 92 void RemoveObserver(DesktopBackgroundControllerObserver* observer); |
| 91 | 93 |
| 92 // Provides current image on the background, or empty gfx::ImageSkia if there | 94 // Provides current image on the background, or empty gfx::ImageSkia if there |
| 93 // is no image, e.g. background is none. | 95 // is no image, e.g. background is none. |
| 94 gfx::ImageSkia GetWallpaper() const; | 96 gfx::ImageSkia GetWallpaper() const; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 wallpaper_reload_delay_ = value; | 184 wallpaper_reload_delay_ = value; |
| 183 } | 185 } |
| 184 | 186 |
| 185 // Returns the maximum size of all displays combined in native | 187 // Returns the maximum size of all displays combined in native |
| 186 // resolutions. Note that this isn't the bounds of the display who | 188 // resolutions. Note that this isn't the bounds of the display who |
| 187 // has maximum resolutions. Instead, this returns the size of the | 189 // has maximum resolutions. Instead, this returns the size of the |
| 188 // maximum width of all displays, and the maximum height of all displays. | 190 // maximum width of all displays, and the maximum height of all displays. |
| 189 static gfx::Size GetMaxDisplaySizeInNative(); | 191 static gfx::Size GetMaxDisplaySizeInNative(); |
| 190 | 192 |
| 191 // If non-NULL, used in place of the real command line. | 193 // If non-NULL, used in place of the real command line. |
| 192 CommandLine* command_line_for_testing_; | 194 base::CommandLine* command_line_for_testing_; |
| 193 | 195 |
| 194 // Can change at runtime. | 196 // Can change at runtime. |
| 195 bool locked_; | 197 bool locked_; |
| 196 | 198 |
| 197 BackgroundMode desktop_background_mode_; | 199 BackgroundMode desktop_background_mode_; |
| 198 | 200 |
| 199 SkColor background_color_; | 201 SkColor background_color_; |
| 200 | 202 |
| 201 ObserverList<DesktopBackgroundControllerObserver> observers_; | 203 ObserverList<DesktopBackgroundControllerObserver> observers_; |
| 202 | 204 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 219 base::OneShotTimer<DesktopBackgroundController> timer_; | 221 base::OneShotTimer<DesktopBackgroundController> timer_; |
| 220 | 222 |
| 221 int wallpaper_reload_delay_; | 223 int wallpaper_reload_delay_; |
| 222 | 224 |
| 223 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); | 225 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); |
| 224 }; | 226 }; |
| 225 | 227 |
| 226 } // namespace ash | 228 } // namespace ash |
| 227 | 229 |
| 228 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ | 230 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ |
| OLD | NEW |