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/aura/window.h" | 16 #include "ui/aura/window.h" |
17 #include "ui/aura/window_observer.h" | 17 #include "ui/aura/window_observer.h" |
18 #include "ui/compositor/layer.h" | 18 #include "ui/compositor/layer.h" |
19 #include "ui/gfx/image/image_skia.h" | 19 #include "ui/gfx/image/image_skia.h" |
20 | 20 |
21 namespace aura { | 21 namespace aura { |
22 class RootWindow; | 22 class RootWindow; |
23 } | 23 } |
24 | 24 |
25 namespace ash { | 25 namespace ash { |
26 | 26 |
27 namespace internal { | |
28 class DesktopBackgroundWidgetController; | |
29 } | |
30 | |
27 class UserWallpaperDelegate { | 31 class UserWallpaperDelegate { |
28 public: | 32 public: |
29 virtual ~UserWallpaperDelegate() {} | 33 virtual ~UserWallpaperDelegate() {} |
30 | 34 |
31 // Returns type of window animation that should be used when showin wallpaper. | 35 // Returns type of window animation that should be used when showin wallpaper. |
32 virtual ash::WindowVisibilityAnimationType GetAnimationType() = 0; | 36 virtual ash::WindowVisibilityAnimationType GetAnimationType() = 0; |
33 | 37 |
34 // Initialize wallpaper. | 38 // Initialize wallpaper. |
35 virtual void InitializeWallpaper() = 0; | 39 virtual void InitializeWallpaper() = 0; |
36 | 40 |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
88 void SetDefaultWallpaper(int index, bool force_reload); | 92 void SetDefaultWallpaper(int index, bool force_reload); |
89 | 93 |
90 // Sets the user selected custom wallpaper. Called when user selected a file | 94 // Sets the user selected custom wallpaper. Called when user selected a file |
91 // from file system or changed the layout of wallpaper. | 95 // from file system or changed the layout of wallpaper. |
92 void SetCustomWallpaper(const gfx::ImageSkia& wallpaper, | 96 void SetCustomWallpaper(const gfx::ImageSkia& wallpaper, |
93 WallpaperLayout layout); | 97 WallpaperLayout layout); |
94 | 98 |
95 // Cancels the current wallpaper loading operation. | 99 // Cancels the current wallpaper loading operation. |
96 void CancelPendingWallpaperOperation(); | 100 void CancelPendingWallpaperOperation(); |
97 | 101 |
102 // Sets the current used component for |root_window|. | |
103 void SetComponentForRootWindow(aura::RootWindow* root_window); | |
104 | |
98 // Sets the desktop background to solid color mode and creates a solid | 105 // Sets the desktop background to solid color mode and creates a solid |
99 // |color| layout. | 106 // |color| layout. |
100 void SetDesktopBackgroundSolidColorMode(SkColor color); | 107 void SetDesktopBackgroundSolidColorMode(SkColor color); |
101 | 108 |
102 // Creates an empty wallpaper. Some tests require a wallpaper widget is ready | 109 // Creates an empty wallpaper. Some tests require a wallpaper widget is ready |
103 // when running. However, the wallpaper widgets are now created asynchronously | 110 // when running. However, the wallpaper widgets are now created asynchronously |
104 // . If loading a real wallpaper, there are cases that these tests crash | 111 // . If loading a real wallpaper, there are cases that these tests crash |
105 // because the required widget is not ready. This function synchronously | 112 // because the required widget is not ready. This function synchronously |
106 // creates an empty widget for those tests to prevent crashes. An example test | 113 // creates an empty widget for those tests to prevent crashes. An example test |
107 // is SystemGestureEventFilterTest.ThreeFingerSwipe. | 114 // is SystemGestureEventFilterTest.ThreeFingerSwipe. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
153 // Returns the appropriate wallpaper resolution for all root windows. | 160 // Returns the appropriate wallpaper resolution for all root windows. |
154 WallpaperResolution GetAppropriateResolution(); | 161 WallpaperResolution GetAppropriateResolution(); |
155 | 162 |
156 // Can change at runtime. | 163 // Can change at runtime. |
157 bool locked_; | 164 bool locked_; |
158 | 165 |
159 BackgroundMode desktop_background_mode_; | 166 BackgroundMode desktop_background_mode_; |
160 | 167 |
161 SkColor background_color_; | 168 SkColor background_color_; |
162 | 169 |
170 typedef std::map<aura::RootWindow*, | |
171 internal::DesktopBackgroundWidgetController*> RootWindowComponentMap; | |
172 RootWindowComponentMap root_window_component_map_; | |
sky
2012/08/10 19:20:37
You never clean this state as roots are removed. I
bshe
2012/08/10 19:51:41
This map is a place to store the component for roo
| |
173 | |
163 // The current wallpaper. | 174 // The current wallpaper. |
164 scoped_ptr<WallpaperData> current_wallpaper_; | 175 scoped_ptr<WallpaperData> current_wallpaper_; |
165 | 176 |
166 scoped_refptr<WallpaperOperation> wallpaper_op_; | 177 scoped_refptr<WallpaperOperation> wallpaper_op_; |
167 | 178 |
168 base::WeakPtrFactory<DesktopBackgroundController> weak_ptr_factory_; | 179 base::WeakPtrFactory<DesktopBackgroundController> weak_ptr_factory_; |
169 | 180 |
170 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); | 181 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundController); |
171 }; | 182 }; |
172 | 183 |
173 } // namespace ash | 184 } // namespace ash |
174 | 185 |
175 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ | 186 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_CONTROLLER_H_ |
OLD | NEW |