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 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 void BeginScopedAnimation(OverviewAnimationType animation_type, | 85 void BeginScopedAnimation(OverviewAnimationType animation_type, |
86 ScopedAnimationSettings* animation_settings); | 86 ScopedAnimationSettings* animation_settings); |
87 | 87 |
88 // Returns true if this window selector window contains the |target|. | 88 // Returns true if this window selector window contains the |target|. |
89 bool Contains(const WmWindow* target) const; | 89 bool Contains(const WmWindow* target) const; |
90 | 90 |
91 // Returns the original target bounds of all transformed windows. | 91 // Returns the original target bounds of all transformed windows. |
92 gfx::Rect GetTargetBoundsInScreen() const; | 92 gfx::Rect GetTargetBoundsInScreen() const; |
93 | 93 |
94 // Calculates the bounds of a |window_| after being transformed to the | 94 // Calculates the bounds of a |window_| after being transformed to the |
95 // selector's space. With Material Design those bounds are a union of all | 95 // selector's space. Those bounds are a union of all regular (normal and |
96 // regular (normal and panel) windows in the |window_|'s transient hierarchy. | 96 // panel) windows in the |window_|'s transient hierarchy. The returned Rect is |
97 // The returned Rect is in virtual screen coordinates. When |hide_header| is | 97 // in virtual screen coordinates. The returned bounds are adjusted to allow |
98 // true the returned bounds are adjusted to allow the original |window_|'s | 98 // the original |window_|'s header to be hidden. |
99 // header to be hidden. | 99 gfx::Rect GetTransformedBounds() const; |
100 gfx::Rect GetTransformedBounds(bool hide_header) const; | |
101 | 100 |
102 // Returns TOP_VIEW_COLOR property of |window_| unless there are transient | 101 // Returns TOP_VIEW_COLOR property of |window_| unless there are transient |
103 // ancestors in which case returns SK_ColorTRANSPARENT. | 102 // ancestors in which case returns SK_ColorTRANSPARENT. |
104 SkColor GetTopColor() const; | 103 SkColor GetTopColor() const; |
105 | 104 |
106 // Returns TOP_VIEW_INSET property of |window_| unless there are transient | 105 // Returns TOP_VIEW_INSET property of |window_| unless there are transient |
107 // ancestors in which case returns 0. | 106 // ancestors in which case returns 0. |
108 int GetTopInset() const; | 107 int GetTopInset() const; |
109 | 108 |
110 // Restores and animates the managed window to it's non overview mode state. | 109 // Restores and animates the managed window to it's non overview mode state. |
111 void RestoreWindow(); | 110 void RestoreWindow(); |
112 | 111 |
113 // Forces the managed window to be shown (ie not hidden or minimized) when | 112 // Forces the managed window to be shown (ie not hidden or minimized) when |
114 // calling RestoreWindow(). | 113 // calling RestoreWindow(). |
115 void ShowWindowOnExit(); | 114 void ShowWindowOnExit(); |
116 | 115 |
117 // Informs the ScopedTransformOverviewWindow that the window being watched was | 116 // Informs the ScopedTransformOverviewWindow that the window being watched was |
118 // destroyed. This resets the internal window pointer. | 117 // destroyed. This resets the internal window pointer. |
119 void OnWindowDestroyed(); | 118 void OnWindowDestroyed(); |
120 | 119 |
121 // Prepares for overview mode by doing any necessary actions before entering. | 120 // Prepares for overview mode by doing any necessary actions before entering. |
122 void PrepareForOverview(); | 121 void PrepareForOverview(); |
123 | 122 |
124 // Applies the |transform| to the overview window and all of its transient | 123 // Applies the |transform| to the overview window and all of its transient |
125 // children. | 124 // children. |
126 void SetTransform(WmWindow* root_window, | 125 void SetTransform(WmWindow* root_window, const gfx::Transform& transform); |
127 const gfx::Transform& transform, | |
128 bool use_mask); | |
129 | 126 |
130 // Set's the opacity of the managed windows. | 127 // Set's the opacity of the managed windows. |
131 void SetOpacity(float opacity); | 128 void SetOpacity(float opacity); |
132 | 129 |
133 // Creates a mask layer with the bottom edge using rounded corners of | 130 // Creates a mask layer with the bottom edge using rounded corners of |
134 // |radius|. When |use_mask| is set, hides the original window header and uses | 131 // |radius|. Uses SetAlphaShape to mask the header. |
135 // rounded rectangle mask which may be resource-intensive. When |use_shape| is | 132 void HideHeaderAndSetShape(int radius); |
136 // set and |use_mask| is not, uses SetAlphaShape to mask the header. | |
137 void HideHeaderAndSetShape(bool use_mask, bool use_shape, int radius); | |
138 | 133 |
139 // Restores original window shape and removes the mask if installed. Safe to | 134 // Restores original window shape and removes the mask if installed. Safe to |
140 // call even if HideHeaderAndSetShape() has not been called. | 135 // call even if HideHeaderAndSetShape() has not been called. |
141 void ShowHeaderAndResetShape(); | 136 void ShowHeaderAndResetShape(); |
142 | 137 |
143 WmWindow* window() const { return window_; } | 138 WmWindow* window() const { return window_; } |
144 | 139 |
145 // Closes the transient root of the window managed by |this|. | 140 // Closes the transient root of the window managed by |this|. |
146 void Close(); | 141 void Close(); |
147 | 142 |
(...skipping 11 matching lines...) Expand all Loading... |
159 | 154 |
160 // Closes the window managed by |this|. | 155 // Closes the window managed by |this|. |
161 void CloseWidget(); | 156 void CloseWidget(); |
162 | 157 |
163 // Makes Close() execute synchronously when used in tests. | 158 // Makes Close() execute synchronously when used in tests. |
164 static void SetImmediateCloseForTests(); | 159 static void SetImmediateCloseForTests(); |
165 | 160 |
166 // A weak pointer to the real window in the overview. | 161 // A weak pointer to the real window in the overview. |
167 WmWindow* window_; | 162 WmWindow* window_; |
168 | 163 |
169 // Mask layer that hides the original window header. | |
170 std::unique_ptr<OverviewContentMask> mask_; | |
171 | |
172 // Original window shape, if it was set on a window. | 164 // Original window shape, if it was set on a window. |
173 std::unique_ptr<SkRegion> original_window_shape_; | 165 std::unique_ptr<SkRegion> original_window_shape_; |
174 | 166 |
175 // True after the |original_window_shape_| has been set or after it has | 167 // True after the |original_window_shape_| has been set or after it has |
176 // been determined that window shape was not originally set on the |window_|. | 168 // been determined that window shape was not originally set on the |window_|. |
177 bool determined_original_window_shape_; | 169 bool determined_original_window_shape_; |
178 | 170 |
179 // Original visibility of |window_| upon entering overview mode that needs to | 171 // Original visibility of |window_| upon entering overview mode that needs to |
180 // be restored unless the window gets selected. | 172 // be restored unless the window gets selected. |
181 OriginalVisibility original_visibility_; | 173 OriginalVisibility original_visibility_; |
(...skipping 15 matching lines...) Expand all Loading... |
197 float original_opacity_; | 189 float original_opacity_; |
198 | 190 |
199 base::WeakPtrFactory<ScopedTransformOverviewWindow> weak_ptr_factory_; | 191 base::WeakPtrFactory<ScopedTransformOverviewWindow> weak_ptr_factory_; |
200 | 192 |
201 DISALLOW_COPY_AND_ASSIGN(ScopedTransformOverviewWindow); | 193 DISALLOW_COPY_AND_ASSIGN(ScopedTransformOverviewWindow); |
202 }; | 194 }; |
203 | 195 |
204 } // namespace ash | 196 } // namespace ash |
205 | 197 |
206 #endif // ASH_COMMON_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ | 198 #endif // ASH_COMMON_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ |
OLD | NEW |