Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: ash/desktop_background/desktop_background_widget_controller.h

Issue 2032613002: Converts RootWindowLayoutManager to common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_WIDGET_CONTROLLER_H_ 5 #ifndef ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_WIDGET_CONTROLLER_H_
6 #define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_WIDGET_CONTROLLER_H_ 6 #define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_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/wm_window_observer.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "ui/aura/window.h"
13 #include "ui/compositor/layer.h"
14 #include "ui/views/widget/widget.h"
15 #include "ui/views/widget/widget_observer.h" 13 #include "ui/views/widget/widget_observer.h"
16 14
15 namespace aura {
16 class Window;
17 }
18
17 namespace ash { 19 namespace ash {
18 class RootWindowController; 20 class RootWindowController;
19 21
20 // This class implements a widget-based wallpaper. 22 // This class implements a widget-based wallpaper.
21 // DesktopBackgroundWidgetController is owned by RootWindowController. 23 // DesktopBackgroundWidgetController is owned by RootWindowController.
22 // When the animation completes the old DesktopBackgroundWidgetController is 24 // When the animation completes the old DesktopBackgroundWidgetController is
23 // destroyed. Exported for tests. 25 // destroyed. Exported for tests.
24 class ASH_EXPORT DesktopBackgroundWidgetController 26 class ASH_EXPORT DesktopBackgroundWidgetController
25 : public views::WidgetObserver { 27 : public views::WidgetObserver,
28 public wm::WmWindowObserver {
26 public: 29 public:
27 // Create 30 // Create
28 explicit DesktopBackgroundWidgetController(views::Widget* widget); 31 explicit DesktopBackgroundWidgetController(views::Widget* widget);
29 32
30 ~DesktopBackgroundWidgetController() override; 33 ~DesktopBackgroundWidgetController() override;
31 34
32 // Overridden from views::WidgetObserver. 35 // Overridden from views::WidgetObserver.
33 void OnWidgetDestroying(views::Widget* widget) override; 36 void OnWidgetDestroying(views::Widget* widget) override;
34 37
35 // Set bounds of component that draws background. 38 // Set bounds of component that draws background.
36 void SetBounds(gfx::Rect bounds); 39 void SetBounds(const gfx::Rect& bounds);
37 40
38 // Move component from |src_container| in |root_window| to |dest_container|. 41 // Move component from |src_container| in |root_window| to |dest_container|.
39 // It is required for lock screen, when we need to move background so that 42 // It is required for lock screen, when we need to move background so that
40 // it hides user's windows. Returns true if there was something to reparent. 43 // it hides user's windows. Returns true if there was something to reparent.
41 bool Reparent(aura::Window* root_window, 44 bool Reparent(aura::Window* root_window,
42 int src_container, 45 int src_container,
43 int dest_container); 46 int dest_container);
44 47
45 // Starts wallpaper fade in animation. |root_window_controller| is 48 // Starts wallpaper fade in animation. |root_window_controller| is
46 // the root window where the animation will happen. (This is 49 // the root window where the animation will happen. (This is
47 // necessary this as |layer_| doesn't have access to the root window). 50 // necessary this as |layer_| doesn't have access to the root window).
48 void StartAnimating(RootWindowController* root_window_controller); 51 void StartAnimating(RootWindowController* root_window_controller);
49 52
50 views::Widget* widget() { return widget_; } 53 views::Widget* widget() { return widget_; }
51 54
52 private: 55 private:
56 void RemoveObservers();
57
58 // wm::WmWindowObserver:
59 void OnWindowBoundsChanged(wm::WmWindow* window,
60 const gfx::Rect& old_bounds,
61 const gfx::Rect& new_bounds) override;
62
53 views::Widget* widget_; 63 views::Widget* widget_;
54 64
65 // Parent of |widget_|.
66 wm::WmWindow* widget_parent_;
67
55 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundWidgetController); 68 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundWidgetController);
56 }; 69 };
57 70
58 // This class wraps a DesktopBackgroundWidgetController pointer. It is owned 71 // This class wraps a DesktopBackgroundWidgetController pointer. It is owned
59 // by RootWindowController. The instance of DesktopBackgroundWidgetController is 72 // by RootWindowController. The instance of DesktopBackgroundWidgetController is
60 // moved to this RootWindowController when the animation completes. 73 // moved to this RootWindowController when the animation completes.
61 // Exported for tests. 74 // Exported for tests.
62 class ASH_EXPORT AnimatingDesktopController { 75 class ASH_EXPORT AnimatingDesktopController {
63 public: 76 public:
64 explicit AnimatingDesktopController( 77 explicit AnimatingDesktopController(
(...skipping 21 matching lines...) Expand all
86 99
87 private: 100 private:
88 std::unique_ptr<DesktopBackgroundWidgetController> controller_; 101 std::unique_ptr<DesktopBackgroundWidgetController> controller_;
89 102
90 DISALLOW_COPY_AND_ASSIGN(AnimatingDesktopController); 103 DISALLOW_COPY_AND_ASSIGN(AnimatingDesktopController);
91 }; 104 };
92 105
93 } // namespace ash 106 } // namespace ash
94 107
95 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_WIDGET_CONTROLLER_H_ 108 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_WIDGET_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698