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/desktop_background/desktop_background_resources.h" | 9 #include "ash/desktop_background/desktop_background_resources.h" |
10 #include "ash/wm/window_animations.h" | 10 #include "ash/wm/window_animations.h" |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "third_party/skia/include/core/SkBitmap.h" | 14 #include "third_party/skia/include/core/SkBitmap.h" |
15 #include "third_party/skia/include/core/SkColor.h" | 15 #include "third_party/skia/include/core/SkColor.h" |
| 16 #include "ui/compositor/layer.h" |
16 #include "ui/gfx/image/image_skia.h" | 17 #include "ui/gfx/image/image_skia.h" |
17 | 18 |
18 namespace aura { | 19 namespace aura { |
19 class RootWindow; | 20 class RootWindow; |
20 } | 21 } |
21 | 22 |
22 namespace ash { | 23 namespace ash { |
23 | 24 |
24 class UserWallpaperDelegate { | 25 class UserWallpaperDelegate { |
25 public: | 26 public: |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 void SetDesktopBackgroundSolidColorMode(SkColor color); | 88 void SetDesktopBackgroundSolidColorMode(SkColor color); |
88 | 89 |
89 // Creates an empty wallpaper. Some tests require a wallpaper widget is ready | 90 // Creates an empty wallpaper. Some tests require a wallpaper widget is ready |
90 // when running. However, the wallpaper widgets are now created asynchronously | 91 // when running. However, the wallpaper widgets are now created asynchronously |
91 // . If loading a real wallpaper, there are cases that these tests crash | 92 // . If loading a real wallpaper, there are cases that these tests crash |
92 // because the required widget is not ready. This function synchronously | 93 // because the required widget is not ready. This function synchronously |
93 // creates an empty widget for those tests to prevent crashes. An example test | 94 // creates an empty widget for those tests to prevent crashes. An example test |
94 // is SystemGestureEventFilterTest.ThreeFingerSwipe. | 95 // is SystemGestureEventFilterTest.ThreeFingerSwipe. |
95 void CreateEmptyWallpaper(); | 96 void CreateEmptyWallpaper(); |
96 | 97 |
| 98 // Create desktop views on Lock Screen layer. |
| 99 void CreateLockScreenDesktops(); |
| 100 |
| 101 // Remove all desktop views on Lock Screen layer created by |
| 102 // CreateLockScreenDesktops. |
| 103 void RemoveLockScreenDesktops(); |
| 104 |
97 private: | 105 private: |
98 // An operation to asynchronously loads wallpaper. | 106 // An operation to asynchronously loads wallpaper. |
99 class WallpaperOperation; | 107 class WallpaperOperation; |
100 | 108 |
101 struct WallpaperData; | 109 struct WallpaperData; |
102 | 110 |
103 // Creates a new background widget using the current wallpapaer image and | 111 // Creates and adds component for current mode (either Widget or Layer) to |
104 // use it as a background of the |root_window|. Deletes the old widget if any. | 112 // |root_window|. |
105 void SetDesktopBackgroundImage(aura::RootWindow* root_window); | 113 void InstallComponent(aura::RootWindow* root_window); |
106 | 114 |
107 // Update the background of all root windows using the current wallpaper image | 115 // Creates view for all root windows, or notifies them to repaint if they |
108 // in |current_wallpaper_|. | 116 // already exist. |
109 void UpdateDesktopBackgroundImageMode(); | 117 void SetDesktopBackgroundImageMode(); |
110 | |
111 // Creates a new background widget and sets the background mode to image mode. | 118 // Creates a new background widget and sets the background mode to image mode. |
112 // Called after wallpaper loaded successfully. | 119 // Called after wallpaper loaded successfully. |
113 void OnWallpaperLoadCompleted(scoped_refptr<WallpaperOperation> wo); | 120 void OnWallpaperLoadCompleted(scoped_refptr<WallpaperOperation> wo); |
114 | 121 |
| 122 // Add layer with solid |color| to container |container_id| in |root_window| |
| 123 ui::Layer* SetColorLayerForContainer(SkColor color, |
| 124 aura::RootWindow* root_window, |
| 125 int container_id); |
| 126 |
115 // Can change at runtime. | 127 // Can change at runtime. |
| 128 bool locked_; |
| 129 |
116 BackgroundMode desktop_background_mode_; | 130 BackgroundMode desktop_background_mode_; |
117 | 131 |
118 SkColor background_color_; | 132 SkColor background_color_; |
119 | 133 |
120 // The current wallpaper. | 134 // The current wallpaper. |
121 scoped_ptr<WallpaperData> current_wallpaper_; | 135 scoped_ptr<WallpaperData> current_wallpaper_; |
122 | 136 |
123 scoped_refptr<WallpaperOperation> wallpaper_op_; | 137 scoped_refptr<WallpaperOperation> wallpaper_op_; |
124 | 138 |
125 base::WeakPtrFactory<DesktopBackgroundController> weak_ptr_factory_; | 139 base::WeakPtrFactory<DesktopBackgroundController> weak_ptr_factory_; |
126 | 140 |
127 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); | 141 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); |
128 }; | 142 }; |
129 | 143 |
130 } // namespace ash | 144 } // namespace ash |
131 | 145 |
132 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ | 146 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ |
OLD | NEW |