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_COMMON_WALLPAPER_WALLPAPER_WIDGET_CONTROLLER_H_ | 5 #ifndef ASH_COMMON_WALLPAPER_WALLPAPER_WIDGET_CONTROLLER_H_ |
6 #define ASH_COMMON_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 ash { | 15 namespace ash { |
16 | 16 |
17 class WmRootWindowController; | 17 class RootWindowController; |
18 class WmWindow; | 18 class WmWindow; |
19 | 19 |
20 // This class implements a widget-based wallpaper. | 20 // This class implements a widget-based wallpaper. |
21 // WallpaperWidgetController is owned by RootWindowController. | 21 // WallpaperWidgetController is owned by RootWindowController. |
22 // When the animation completes the old WallpaperWidgetController is | 22 // When the animation completes the old WallpaperWidgetController is |
23 // destroyed. Exported for tests. | 23 // destroyed. Exported for tests. |
24 class ASH_EXPORT WallpaperWidgetController : public views::WidgetObserver, | 24 class ASH_EXPORT WallpaperWidgetController : public views::WidgetObserver, |
25 public WmWindowObserver { | 25 public WmWindowObserver { |
26 public: | 26 public: |
27 explicit WallpaperWidgetController(views::Widget* widget); | 27 explicit WallpaperWidgetController(views::Widget* widget); |
28 ~WallpaperWidgetController() override; | 28 ~WallpaperWidgetController() override; |
29 | 29 |
30 // Overridden from views::WidgetObserver. | 30 // Overridden from views::WidgetObserver. |
31 void OnWidgetDestroying(views::Widget* widget) override; | 31 void OnWidgetDestroying(views::Widget* widget) override; |
32 | 32 |
33 // Set bounds for the widget that draws the wallpaper. | 33 // Set bounds for the widget that draws the wallpaper. |
34 void SetBounds(const gfx::Rect& bounds); | 34 void SetBounds(const gfx::Rect& bounds); |
35 | 35 |
36 // Move the wallpaper for |root_window| to the specified |container|. | 36 // Move the wallpaper for |root_window| to the specified |container|. |
37 // 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. |
38 // Returns true if there was something to reparent. | 38 // Returns true if there was something to reparent. |
39 bool Reparent(WmWindow* root_window, int container); | 39 bool Reparent(WmWindow* root_window, int container); |
40 | 40 |
41 // Starts wallpaper fade in animation. |root_window_controller| is | 41 // Starts wallpaper fade in animation. |root_window_controller| is |
42 // the root window where the animation will happen. (This is | 42 // the root window where the animation will happen. (This is |
43 // 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). |
44 void StartAnimating(WmRootWindowController* root_window_controller); | 44 void StartAnimating(RootWindowController* root_window_controller); |
45 | 45 |
46 views::Widget* widget() { return widget_; } | 46 views::Widget* widget() { return widget_; } |
47 | 47 |
48 private: | 48 private: |
49 void RemoveObservers(); | 49 void RemoveObservers(); |
50 | 50 |
51 // WmWindowObserver: | 51 // WmWindowObserver: |
52 void OnWindowBoundsChanged(WmWindow* window, | 52 void OnWindowBoundsChanged(WmWindow* window, |
53 const gfx::Rect& old_bounds, | 53 const gfx::Rect& old_bounds, |
54 const gfx::Rect& new_bounds) override; | 54 const gfx::Rect& new_bounds) override; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 private: | 93 private: |
94 std::unique_ptr<WallpaperWidgetController> controller_; | 94 std::unique_ptr<WallpaperWidgetController> controller_; |
95 | 95 |
96 DISALLOW_COPY_AND_ASSIGN(AnimatingWallpaperWidgetController); | 96 DISALLOW_COPY_AND_ASSIGN(AnimatingWallpaperWidgetController); |
97 }; | 97 }; |
98 | 98 |
99 } // namespace ash | 99 } // namespace ash |
100 | 100 |
101 #endif // ASH_COMMON_WALLPAPER_WALLPAPER_WIDGET_CONTROLLER_H_ | 101 #endif // ASH_COMMON_WALLPAPER_WALLPAPER_WIDGET_CONTROLLER_H_ |
OLD | NEW |