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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ash/ash_export.h" | 9 #include "ash/ash_export.h" |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 | 11 |
12 class SkBitmap; | 12 class SkBitmap; |
13 | 13 |
14 namespace ash { | 14 namespace ash { |
15 | 15 |
| 16 class UserWallpaperDelegate { |
| 17 public: |
| 18 virtual ~UserWallpaperDelegate() {} |
| 19 |
| 20 // Gets the index of user selected wallpaper |
| 21 virtual const int GetUserWallpaperIndex() = 0; |
| 22 }; |
| 23 |
16 // A class to listen for login and desktop background change events and set the | 24 // A class to listen for login and desktop background change events and set the |
17 // corresponding default wallpaper in Aura shell. | 25 // corresponding default wallpaper in Aura shell. |
18 class ASH_EXPORT DesktopBackgroundController { | 26 class ASH_EXPORT DesktopBackgroundController { |
19 public: | 27 public: |
20 enum BackgroundMode { | 28 enum BackgroundMode { |
21 BACKGROUND_IMAGE, | 29 BACKGROUND_IMAGE, |
22 BACKGROUND_SOLID_COLOR | 30 BACKGROUND_SOLID_COLOR |
23 }; | 31 }; |
24 | 32 |
25 DesktopBackgroundController(); | 33 DesktopBackgroundController(); |
26 virtual ~DesktopBackgroundController(); | 34 virtual ~DesktopBackgroundController(); |
27 | 35 |
28 // Get the desktop background mode. | 36 // Get the desktop background mode. |
29 BackgroundMode desktop_background_mode() const { | 37 BackgroundMode desktop_background_mode() const { |
30 return desktop_background_mode_; | 38 return desktop_background_mode_; |
31 } | 39 } |
32 | 40 |
33 // Change the desktop background image to wallpaper with |index|. | 41 // Change the desktop background image to wallpaper with |index|. |
34 void OnDesktopBackgroundChanged(int index); | 42 void OnDesktopBackgroundChanged(); |
35 | 43 |
36 // Sets the desktop background to image mode and create a new background | 44 // Sets the desktop background to image mode and create a new background |
37 // widget with |wallpaper|. | 45 // widget with |wallpaper|. |
38 void SetDesktopBackgroundImageMode(const SkBitmap& wallpaper); | 46 void SetDesktopBackgroundImageMode(const SkBitmap& wallpaper); |
39 | 47 |
40 // Sets the desktop background to image mode and create a new background | |
41 // widget with default wallpaper. | |
42 void SetDefaultDesktopBackgroundImage(); | |
43 | |
44 // Sets the desktop background to image mode and create a new background | |
45 // widget with previous selected wallpaper at run time. | |
46 void SetPreviousDesktopBackgroundImage(); | |
47 | |
48 // Sets the desktop background to solid color mode and create a solid color | 48 // Sets the desktop background to solid color mode and create a solid color |
49 // layout. | 49 // layout. |
50 void SetDesktopBackgroundSolidColorMode(); | 50 void SetDesktopBackgroundSolidColorMode(); |
51 | 51 |
52 private: | 52 private: |
53 // We need to cache the previously used wallpaper index. So when users switch | |
54 // desktop background color mode at run time, we can directly switch back to | |
55 // the user selected wallpaper in image mode. | |
56 int previous_wallpaper_index_; | |
57 | |
58 // Can change at runtime. | 53 // Can change at runtime. |
59 BackgroundMode desktop_background_mode_; | 54 BackgroundMode desktop_background_mode_; |
60 | 55 |
61 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); | 56 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); |
62 }; | 57 }; |
63 | 58 |
64 } // namespace ash | 59 } // namespace ash |
65 | 60 |
66 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ | 61 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ |
OLD | NEW |