OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ | 5 #ifndef ASH_COMMON_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ |
6 #define ASH_COMMON_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ | 6 #define ASH_COMMON_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "ash/ash_export.h" | 11 #include "ash/ash_export.h" |
12 #include "ash/common/wm/overview/overview_animation_type.h" | 12 #include "ash/common/wm/overview/overview_animation_type.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
15 #include "ui/gfx/geometry/size.h" | 15 #include "ui/gfx/geometry/size.h" |
16 #include "ui/gfx/transform.h" | 16 #include "ui/gfx/transform.h" |
17 | 17 |
| 18 class SkRegion; |
| 19 |
18 namespace gfx { | 20 namespace gfx { |
19 class Rect; | 21 class Rect; |
20 } | 22 } |
21 | 23 |
22 namespace ash { | 24 namespace ash { |
23 | 25 |
24 class ScopedOverviewAnimationSettings; | 26 class ScopedOverviewAnimationSettings; |
25 class WmWindow; | 27 class WmWindow; |
26 | 28 |
27 // Manages a window, and it's transient children, in the overview mode. This | 29 // Manages a window, and it's transient children, in the overview mode. This |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 void OnWindowDestroyed(); | 101 void OnWindowDestroyed(); |
100 | 102 |
101 // Prepares for overview mode by doing any necessary actions before entering. | 103 // Prepares for overview mode by doing any necessary actions before entering. |
102 void PrepareForOverview(); | 104 void PrepareForOverview(); |
103 | 105 |
104 // Applies the |transform| to the overview window and all of its transient | 106 // Applies the |transform| to the overview window and all of its transient |
105 // children. With Material Design creates a mask layer with the bottom edge | 107 // children. With Material Design creates a mask layer with the bottom edge |
106 // using rounded corners of |radius|. | 108 // using rounded corners of |radius|. |
107 void SetTransform(WmWindow* root_window, | 109 void SetTransform(WmWindow* root_window, |
108 const gfx::Transform& transform, | 110 const gfx::Transform& transform, |
109 int radius); | 111 float radius); |
110 | 112 |
111 // Set's the opacity of the managed windows. | 113 // Set's the opacity of the managed windows. |
112 void SetOpacity(float opacity); | 114 void SetOpacity(float opacity); |
113 | 115 |
114 WmWindow* window() const { return window_; } | 116 WmWindow* window() const { return window_; } |
115 | 117 |
116 // Closes the transient root of the window managed by |this|. | 118 // Closes the transient root of the window managed by |this|. |
117 void Close(); | 119 void Close(); |
118 | 120 |
119 private: | 121 private: |
120 friend class WindowSelectorTest; | 122 friend class WindowSelectorTest; |
121 class OverviewContentMask; | 123 class OverviewContentMask; |
122 | 124 |
123 // Shows the window if it was minimized. | 125 // Shows the window if it was minimized. |
124 void ShowWindowIfMinimized(); | 126 void ShowWindowIfMinimized(); |
125 | 127 |
126 // Closes the window managed by |this|. | 128 // Closes the window managed by |this|. |
127 void CloseWidget(); | 129 void CloseWidget(); |
128 | 130 |
129 // Makes Close() execute synchronously when used in tests. | 131 // Makes Close() execute synchronously when used in tests. |
130 static void SetImmediateCloseForTests(); | 132 static void SetImmediateCloseForTests(); |
131 | 133 |
132 // A weak pointer to the real window in the overview. | 134 // A weak pointer to the real window in the overview. |
133 WmWindow* window_; | 135 WmWindow* window_; |
134 | 136 |
135 // Mask layer that hides the original window header. | 137 // Mask layer that hides the original window header. |
136 std::unique_ptr<OverviewContentMask> mask_; | 138 std::unique_ptr<OverviewContentMask> mask_; |
137 | 139 |
| 140 // Original window shape, if it was set on a window. |
| 141 std::unique_ptr<SkRegion> original_window_shape_; |
| 142 |
138 // If true, the window was minimized and should be restored if the window | 143 // If true, the window was minimized and should be restored if the window |
139 // was not selected. | 144 // was not selected. |
140 bool minimized_; | 145 bool minimized_; |
141 | 146 |
142 // Tracks if this window was ignored by the shelf. | 147 // Tracks if this window was ignored by the shelf. |
143 bool ignored_by_shelf_; | 148 bool ignored_by_shelf_; |
144 | 149 |
145 // True if the window has been transformed for overview mode. | 150 // True if the window has been transformed for overview mode. |
146 bool overview_started_; | 151 bool overview_started_; |
147 | 152 |
148 // The original transform of the window before entering overview mode. | 153 // The original transform of the window before entering overview mode. |
149 gfx::Transform original_transform_; | 154 gfx::Transform original_transform_; |
150 | 155 |
151 // Keeps track of the original transform used when |this| has been positioned | 156 // Keeps track of the original transform used when |this| has been positioned |
152 // during SelectorItem layout. | 157 // during SelectorItem layout. |
153 gfx::Transform overview_transform_; | 158 gfx::Transform overview_transform_; |
154 | 159 |
155 // The original opacity of the window before entering overview mode. | 160 // The original opacity of the window before entering overview mode. |
156 float original_opacity_; | 161 float original_opacity_; |
157 | 162 |
158 base::WeakPtrFactory<ScopedTransformOverviewWindow> weak_ptr_factory_; | 163 base::WeakPtrFactory<ScopedTransformOverviewWindow> weak_ptr_factory_; |
159 | 164 |
160 DISALLOW_COPY_AND_ASSIGN(ScopedTransformOverviewWindow); | 165 DISALLOW_COPY_AND_ASSIGN(ScopedTransformOverviewWindow); |
161 }; | 166 }; |
162 | 167 |
163 } // namespace ash | 168 } // namespace ash |
164 | 169 |
165 #endif // ASH_COMMON_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ | 170 #endif // ASH_COMMON_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ |
OLD | NEW |