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_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ | 5 #ifndef ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ |
6 #define ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ | 6 #define ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 class Rect; | 27 class Rect; |
28 } | 28 } |
29 | 29 |
30 namespace views { | 30 namespace views { |
31 class Widget; | 31 class Widget; |
32 } | 32 } |
33 | 33 |
34 namespace ash { | 34 namespace ash { |
35 | 35 |
36 class ScopedOverviewAnimationSettings; | 36 class ScopedOverviewAnimationSettings; |
37 class WindowSelectorItem; | |
38 | 37 |
39 // Manages a window, and its transient children, in the overview mode. This | 38 // Manages a window, and its transient children, in the overview mode. This |
40 // class allows transforming the windows with a helper to determine the best | 39 // class allows transforming the windows with a helper to determine the best |
41 // fit in certain bounds. The window's state is restored when this object is | 40 // fit in certain bounds. The window's state is restored when this object is |
42 // destroyed. | 41 // destroyed. |
43 class ASH_EXPORT ScopedTransformOverviewWindow : public ui::EventHandler { | 42 class ASH_EXPORT ScopedTransformOverviewWindow : public ui::EventHandler { |
44 public: | 43 public: |
45 class OverviewContentMask; | 44 class OverviewContentMask; |
46 using ScopedAnimationSettings = | 45 using ScopedAnimationSettings = |
47 std::vector<std::unique_ptr<ScopedOverviewAnimationSettings>>; | 46 std::vector<std::unique_ptr<ScopedOverviewAnimationSettings>>; |
(...skipping 11 matching lines...) Expand all Loading... |
59 // |title_height| tall in the transformed window. | 58 // |title_height| tall in the transformed window. |
60 static gfx::Rect ShrinkRectToFitPreservingAspectRatio(const gfx::Rect& rect, | 59 static gfx::Rect ShrinkRectToFitPreservingAspectRatio(const gfx::Rect& rect, |
61 const gfx::Rect& bounds, | 60 const gfx::Rect& bounds, |
62 int top_view_inset, | 61 int top_view_inset, |
63 int title_height); | 62 int title_height); |
64 | 63 |
65 // Returns the transform turning |src_rect| into |dst_rect|. | 64 // Returns the transform turning |src_rect| into |dst_rect|. |
66 static gfx::Transform GetTransformForRect(const gfx::Rect& src_rect, | 65 static gfx::Transform GetTransformForRect(const gfx::Rect& src_rect, |
67 const gfx::Rect& dst_rect); | 66 const gfx::Rect& dst_rect); |
68 | 67 |
69 ScopedTransformOverviewWindow(WindowSelectorItem* selector_item, | 68 explicit ScopedTransformOverviewWindow(aura::Window* window); |
70 aura::Window* window); | |
71 ~ScopedTransformOverviewWindow() override; | 69 ~ScopedTransformOverviewWindow() override; |
72 | 70 |
73 // Starts an animation sequence which will use animation settings specified by | 71 // Starts an animation sequence which will use animation settings specified by |
74 // |animation_type|. The |animation_settings| container is populated with | 72 // |animation_type|. The |animation_settings| container is populated with |
75 // scoped entities and the container should be destroyed at the end of the | 73 // scoped entities and the container should be destroyed at the end of the |
76 // animation sequence. | 74 // animation sequence. |
77 // | 75 // |
78 // Example: | 76 // Example: |
79 // ScopedTransformOverviewWindow overview_window(window); | 77 // ScopedTransformOverviewWindow overview_window(window); |
80 // ScopedTransformOverviewWindow::ScopedAnimationSettings scoped_settings; | 78 // ScopedTransformOverviewWindow::ScopedAnimationSettings scoped_settings; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 friend class WindowSelectorTest; | 158 friend class WindowSelectorTest; |
161 | 159 |
162 // Closes the window managed by |this|. | 160 // Closes the window managed by |this|. |
163 void CloseWidget(); | 161 void CloseWidget(); |
164 | 162 |
165 void CreateMirrorWindowForMinimizedState(); | 163 void CreateMirrorWindowForMinimizedState(); |
166 | 164 |
167 // Makes Close() execute synchronously when used in tests. | 165 // Makes Close() execute synchronously when used in tests. |
168 static void SetImmediateCloseForTests(); | 166 static void SetImmediateCloseForTests(); |
169 | 167 |
170 // A weak pointer to the window selector item that owns the transform window. | |
171 WindowSelectorItem* selector_item_; | |
172 | |
173 // A weak pointer to the real window in the overview. | 168 // A weak pointer to the real window in the overview. |
174 aura::Window* window_; | 169 aura::Window* window_; |
175 | 170 |
176 // Original |window_|'s shape, if it was set on the window. | 171 // Original |window_|'s shape, if it was set on the window. |
177 std::unique_ptr<SkRegion> original_window_shape_; | 172 std::unique_ptr<SkRegion> original_window_shape_; |
178 | 173 |
179 // True after the |original_window_shape_| has been set or after it has | 174 // True after the |original_window_shape_| has been set or after it has |
180 // been determined that window shape was not originally set on the |window_|. | 175 // been determined that window shape was not originally set on the |window_|. |
181 bool determined_original_window_shape_; | 176 bool determined_original_window_shape_; |
182 | 177 |
(...skipping 13 matching lines...) Expand all Loading... |
196 std::unique_ptr<views::Widget> minimized_widget_; | 191 std::unique_ptr<views::Widget> minimized_widget_; |
197 | 192 |
198 base::WeakPtrFactory<ScopedTransformOverviewWindow> weak_ptr_factory_; | 193 base::WeakPtrFactory<ScopedTransformOverviewWindow> weak_ptr_factory_; |
199 | 194 |
200 DISALLOW_COPY_AND_ASSIGN(ScopedTransformOverviewWindow); | 195 DISALLOW_COPY_AND_ASSIGN(ScopedTransformOverviewWindow); |
201 }; | 196 }; |
202 | 197 |
203 } // namespace ash | 198 } // namespace ash |
204 | 199 |
205 #endif // ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ | 200 #endif // ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ |
OLD | NEW |