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_WALLPAPER_WALLPAPER_WIDGET_CONTROLLER_H_ | 5 #ifndef ASH_COMMON_WALLPAPER_WALLPAPER_WIDGET_CONTROLLER_H_ |
6 #define ASH_WALLPAPER_WALLPAPER_WIDGET_CONTROLLER_H_ | 6 #define ASH_COMMON_WALLPAPER_WALLPAPER_WIDGET_CONTROLLER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/common/wm_window_observer.h" | 11 #include "ash/common/wm_window_observer.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "ui/views/widget/widget_observer.h" | 13 #include "ui/views/widget/widget_observer.h" |
14 | 14 |
15 namespace aura { | 15 namespace ash { |
16 class Window; | |
17 } | |
18 | 16 |
19 namespace ash { | 17 class WmRootWindowController; |
20 class RootWindowController; | 18 class WmWindow; |
21 | 19 |
22 // This class implements a widget-based wallpaper. | 20 // This class implements a widget-based wallpaper. |
23 // WallpaperWidgetController is owned by RootWindowController. | 21 // WallpaperWidgetController is owned by RootWindowController. |
24 // When the animation completes the old WallpaperWidgetController is | 22 // When the animation completes the old WallpaperWidgetController is |
25 // destroyed. Exported for tests. | 23 // destroyed. Exported for tests. |
26 class ASH_EXPORT WallpaperWidgetController : public views::WidgetObserver, | 24 class ASH_EXPORT WallpaperWidgetController : public views::WidgetObserver, |
27 public WmWindowObserver { | 25 public WmWindowObserver { |
28 public: | 26 public: |
29 explicit WallpaperWidgetController(views::Widget* widget); | 27 explicit WallpaperWidgetController(views::Widget* widget); |
30 ~WallpaperWidgetController() override; | 28 ~WallpaperWidgetController() override; |
31 | 29 |
32 // Overridden from views::WidgetObserver. | 30 // Overridden from views::WidgetObserver. |
33 void OnWidgetDestroying(views::Widget* widget) override; | 31 void OnWidgetDestroying(views::Widget* widget) override; |
34 | 32 |
35 // Set bounds for the widget that draws the wallpaper. | 33 // Set bounds for the widget that draws the wallpaper. |
36 void SetBounds(const gfx::Rect& bounds); | 34 void SetBounds(const gfx::Rect& bounds); |
37 | 35 |
38 // Move the wallpaper for |root_window| to the specified |container|. | 36 // Move the wallpaper for |root_window| to the specified |container|. |
39 // The lock screen moves the wallpaper container to hides the user's windows. | 37 // The lock screen moves the wallpaper container to hides the user's windows. |
40 // Returns true if there was something to reparent. | 38 // Returns true if there was something to reparent. |
41 bool Reparent(aura::Window* root_window, int container); | 39 bool Reparent(WmWindow* root_window, int container); |
42 | 40 |
43 // Starts wallpaper fade in animation. |root_window_controller| is | 41 // Starts wallpaper fade in animation. |root_window_controller| is |
44 // the root window where the animation will happen. (This is | 42 // the root window where the animation will happen. (This is |
45 // necessary this as |layer_| doesn't have access to the root window). | 43 // necessary this as |layer_| doesn't have access to the root window). |
46 void StartAnimating(RootWindowController* root_window_controller); | 44 void StartAnimating(WmRootWindowController* root_window_controller); |
47 | 45 |
48 views::Widget* widget() { return widget_; } | 46 views::Widget* widget() { return widget_; } |
49 | 47 |
50 private: | 48 private: |
51 void RemoveObservers(); | 49 void RemoveObservers(); |
52 | 50 |
53 // WmWindowObserver: | 51 // WmWindowObserver: |
54 void OnWindowBoundsChanged(WmWindow* window, | 52 void OnWindowBoundsChanged(WmWindow* window, |
55 const gfx::Rect& old_bounds, | 53 const gfx::Rect& old_bounds, |
56 const gfx::Rect& new_bounds) override; | 54 const gfx::Rect& new_bounds) override; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 WallpaperWidgetController* GetController(bool pass_ownership); | 91 WallpaperWidgetController* GetController(bool pass_ownership); |
94 | 92 |
95 private: | 93 private: |
96 std::unique_ptr<WallpaperWidgetController> controller_; | 94 std::unique_ptr<WallpaperWidgetController> controller_; |
97 | 95 |
98 DISALLOW_COPY_AND_ASSIGN(AnimatingWallpaperWidgetController); | 96 DISALLOW_COPY_AND_ASSIGN(AnimatingWallpaperWidgetController); |
99 }; | 97 }; |
100 | 98 |
101 } // namespace ash | 99 } // namespace ash |
102 | 100 |
103 #endif // ASH_WALLPAPER_WALLPAPER_WIDGET_CONTROLLER_H_ | 101 #endif // ASH_COMMON_WALLPAPER_WALLPAPER_WIDGET_CONTROLLER_H_ |
OLD | NEW |