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