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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 int top_view_inset, | 54 int top_view_inset, |
55 int title_height); | 55 int title_height); |
56 | 56 |
57 // Returns the transform turning |src_rect| into |dst_rect|. | 57 // Returns the transform turning |src_rect| into |dst_rect|. |
58 static gfx::Transform GetTransformForRect(const gfx::Rect& src_rect, | 58 static gfx::Transform GetTransformForRect(const gfx::Rect& src_rect, |
59 const gfx::Rect& dst_rect); | 59 const gfx::Rect& dst_rect); |
60 | 60 |
61 explicit ScopedTransformOverviewWindow(WmWindow* window); | 61 explicit ScopedTransformOverviewWindow(WmWindow* window); |
62 ~ScopedTransformOverviewWindow(); | 62 ~ScopedTransformOverviewWindow(); |
63 | 63 |
64 gfx::Transform get_overview_transform() const { return overview_transform_; } | |
65 | |
66 void set_overview_transform(const gfx::Transform& transform) { | |
67 overview_transform_ = transform; | |
68 } | |
69 | |
70 // Starts an animation sequence which will use animation settings specified by | 64 // Starts an animation sequence which will use animation settings specified by |
71 // |animation_type|. The |animation_settings| container is populated with | 65 // |animation_type|. The |animation_settings| container is populated with |
72 // scoped entities and the container should be destroyed at the end of the | 66 // scoped entities and the container should be destroyed at the end of the |
73 // animation sequence. | 67 // animation sequence. |
74 // | 68 // |
75 // Example: | 69 // Example: |
76 // ScopedTransformOverviewWindow overview_window(window); | 70 // ScopedTransformOverviewWindow overview_window(window); |
77 // ScopedTransformOverviewWindow::ScopedAnimationSettings scoped_settings; | 71 // ScopedTransformOverviewWindow::ScopedAnimationSettings scoped_settings; |
78 // overview_window.BeginScopedAnimation( | 72 // overview_window.BeginScopedAnimation( |
79 // OverviewAnimationType::OVERVIEW_ANIMATION_SELECTOR_ITEM_SCROLL_CANCEL, | 73 // OverviewAnimationType::OVERVIEW_ANIMATION_SELECTOR_ITEM_SCROLL_CANCEL, |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // Prepares for overview mode by doing any necessary actions before entering. | 114 // Prepares for overview mode by doing any necessary actions before entering. |
121 void PrepareForOverview(); | 115 void PrepareForOverview(); |
122 | 116 |
123 // Applies the |transform| to the overview window and all of its transient | 117 // Applies the |transform| to the overview window and all of its transient |
124 // children. | 118 // children. |
125 void SetTransform(WmWindow* root_window, const gfx::Transform& transform); | 119 void SetTransform(WmWindow* root_window, const gfx::Transform& transform); |
126 | 120 |
127 // Set's the opacity of the managed windows. | 121 // Set's the opacity of the managed windows. |
128 void SetOpacity(float opacity); | 122 void SetOpacity(float opacity); |
129 | 123 |
130 // Creates a mask layer with the bottom edge using rounded corners of | 124 // Hides the window header whose size is given in |TOP_VIEW_INSET| |
131 // |radius|. Uses SetAlphaShape to mask the header. | 125 // window property. |
132 void HideHeaderAndSetShape(int radius); | 126 void HideHeader(); |
133 | 127 |
134 // Restores original window shape and removes the mask if installed. Safe to | 128 // Shows the window header that is hidden by HideHeader(). |
135 // call even if HideHeaderAndSetShape() has not been called. | 129 void ShowHeader(); |
136 void ShowHeaderAndResetShape(); | |
137 | 130 |
138 WmWindow* window() const { return window_; } | 131 WmWindow* window() const { return window_; } |
139 | 132 |
140 // Closes the transient root of the window managed by |this|. | 133 // Closes the transient root of the window managed by |this|. |
141 void Close(); | 134 void Close(); |
142 | 135 |
143 private: | 136 private: |
144 friend class WindowSelectorTest; | 137 friend class WindowSelectorTest; |
145 | 138 |
146 enum OriginalVisibility { | 139 enum OriginalVisibility { |
(...skipping 27 matching lines...) Expand all Loading... |
174 | 167 |
175 // Tracks if this window was ignored by the shelf. | 168 // Tracks if this window was ignored by the shelf. |
176 bool ignored_by_shelf_; | 169 bool ignored_by_shelf_; |
177 | 170 |
178 // True if the window has been transformed for overview mode. | 171 // True if the window has been transformed for overview mode. |
179 bool overview_started_; | 172 bool overview_started_; |
180 | 173 |
181 // The original transform of the window before entering overview mode. | 174 // The original transform of the window before entering overview mode. |
182 gfx::Transform original_transform_; | 175 gfx::Transform original_transform_; |
183 | 176 |
184 // Keeps track of the original transform used when |this| has been positioned | |
185 // during SelectorItem layout. | |
186 gfx::Transform overview_transform_; | |
187 | |
188 // The original opacity of the window before entering overview mode. | 177 // The original opacity of the window before entering overview mode. |
189 float original_opacity_; | 178 float original_opacity_; |
190 | 179 |
191 base::WeakPtrFactory<ScopedTransformOverviewWindow> weak_ptr_factory_; | 180 base::WeakPtrFactory<ScopedTransformOverviewWindow> weak_ptr_factory_; |
192 | 181 |
193 DISALLOW_COPY_AND_ASSIGN(ScopedTransformOverviewWindow); | 182 DISALLOW_COPY_AND_ASSIGN(ScopedTransformOverviewWindow); |
194 }; | 183 }; |
195 | 184 |
196 } // namespace ash | 185 } // namespace ash |
197 | 186 |
198 #endif // ASH_COMMON_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ | 187 #endif // ASH_COMMON_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ |
OLD | NEW |