OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_WM_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_ | 5 #ifndef ASH_WM_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_ |
6 #define ASH_WM_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_ | 6 #define ASH_WM_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_ |
7 | 7 |
| 8 #include <memory> |
| 9 |
8 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
9 #include "ash/wm/workspace/workspace_layout_manager_backdrop_delegate.h" | 11 #include "ash/wm/workspace/workspace_layout_manager_backdrop_delegate.h" |
10 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "ui/aura/window_observer.h" | |
13 | 14 |
14 namespace aura { | 15 namespace aura { |
15 class Window; | 16 class Window; |
16 } | 17 } |
17 | 18 |
18 namespace ui { | |
19 class Layer; | |
20 } | |
21 | |
22 namespace views { | 19 namespace views { |
23 class Widget; | 20 class Widget; |
24 } | 21 } |
25 | 22 |
26 namespace ash { | 23 namespace ash { |
27 | 24 |
28 // A background which gets created for a container |window| and which gets | 25 // A background which gets created for a container |window| and which gets |
29 // stacked behind the topmost window (within that container) covering the | 26 // stacked behind the topmost window (within that container) covering the |
30 // entire container. | 27 // entire container. |
31 class ASH_EXPORT WorkspaceBackdropDelegate | 28 class ASH_EXPORT WorkspaceBackdropDelegate |
32 : public aura::WindowObserver, | 29 : public WorkspaceLayoutManagerBackdropDelegate { |
33 public WorkspaceLayoutManagerBackdropDelegate { | |
34 public: | 30 public: |
35 explicit WorkspaceBackdropDelegate(aura::Window* container); | 31 explicit WorkspaceBackdropDelegate(aura::Window* container); |
36 ~WorkspaceBackdropDelegate() override; | 32 ~WorkspaceBackdropDelegate() override; |
37 | 33 |
38 // WindowObserver overrides: | |
39 void OnWindowBoundsChanged(aura::Window* window, | |
40 const gfx::Rect& old_bounds, | |
41 const gfx::Rect& new_bounds) override; | |
42 | |
43 // WorkspaceLayoutManagerBackdropDelegate overrides: | 34 // WorkspaceLayoutManagerBackdropDelegate overrides: |
44 void OnWindowAddedToLayout(aura::Window* child) override; | 35 void OnWindowAddedToLayout(wm::WmWindow* child) override; |
45 void OnWindowRemovedFromLayout(aura::Window* child) override; | 36 void OnWindowRemovedFromLayout(wm::WmWindow* child) override; |
46 void OnChildWindowVisibilityChanged(aura::Window* child, | 37 void OnChildWindowVisibilityChanged(wm::WmWindow* child, |
47 bool visible) override; | 38 bool visible) override; |
48 void OnWindowStackingChanged(aura::Window* window) override; | 39 void OnWindowStackingChanged(wm::WmWindow* window) override; |
49 void OnPostWindowStateTypeChange(wm::WindowState* window_state, | 40 void OnPostWindowStateTypeChange(wm::WindowState* window_state, |
50 wm::WindowStateType old_type) override; | 41 wm::WindowStateType old_type) override; |
51 void OnDisplayWorkAreaInsetsChanged() override; | 42 void OnDisplayWorkAreaInsetsChanged() override; |
52 | 43 |
53 private: | 44 private: |
| 45 class WindowObserverImpl; |
| 46 |
54 // Restack the backdrop relatively to the other windows in the container. | 47 // Restack the backdrop relatively to the other windows in the container. |
55 void RestackBackdrop(); | 48 void RestackBackdrop(); |
56 | 49 |
57 // Returns the current visible top level window in the container. | 50 // Returns the current visible top level window in the container. |
58 aura::Window* GetCurrentTopWindow(); | 51 aura::Window* GetCurrentTopWindow(); |
59 | 52 |
60 // Position & size the background over the container window. | 53 // Position & size the background over the container window. |
61 void AdjustToContainerBounds(); | 54 void AdjustToContainerBounds(); |
62 | 55 |
63 // Show the overlay. | 56 // Show the overlay. |
64 void Show(); | 57 void Show(); |
65 | 58 |
| 59 std::unique_ptr<WindowObserverImpl> container_observer_; |
| 60 |
66 // The background which covers the rest of the screen. | 61 // The background which covers the rest of the screen. |
67 views::Widget* background_; | 62 views::Widget* background_; |
68 | 63 |
69 // The window which is being "maximized". | 64 // The window which is being "maximized". |
70 aura::Window* container_; | 65 aura::Window* container_; |
71 | 66 |
72 // If true, the |RestackOrHideWindow| might recurse. | 67 // If true, the |RestackOrHideWindow| might recurse. |
73 bool in_restacking_; | 68 bool in_restacking_; |
74 | 69 |
75 DISALLOW_COPY_AND_ASSIGN(WorkspaceBackdropDelegate); | 70 DISALLOW_COPY_AND_ASSIGN(WorkspaceBackdropDelegate); |
76 }; | 71 }; |
77 | 72 |
78 } // namespace ash | 73 } // namespace ash |
79 | 74 |
80 #endif // ASH_WM_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_ | 75 #endif // ASH_WM_MAXIMIZE_MODE_WORKSPACE_BACKDROP_DELEGATE_H_ |
OLD | NEW |