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