Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: ash/wm/overview/scoped_transform_overview_window.h

Issue 2918403006: CrOS Tablet Window management - Split Screen part I (Closed)
Patch Set: Add unittests. Will split the CL into two CLs. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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;
37 38
38 // Manages a window, and its transient children, in the overview mode. This 39 // Manages a window, and its transient children, in the overview mode. This
39 // class allows transforming the windows with a helper to determine the best 40 // class allows transforming the windows with a helper to determine the best
40 // fit in certain bounds. The window's state is restored when this object is 41 // fit in certain bounds. The window's state is restored when this object is
41 // destroyed. 42 // destroyed.
42 class ASH_EXPORT ScopedTransformOverviewWindow : public ui::EventHandler { 43 class ASH_EXPORT ScopedTransformOverviewWindow : public ui::EventHandler {
43 public: 44 public:
44 class OverviewContentMask; 45 class OverviewContentMask;
45 using ScopedAnimationSettings = 46 using ScopedAnimationSettings =
46 std::vector<std::unique_ptr<ScopedOverviewAnimationSettings>>; 47 std::vector<std::unique_ptr<ScopedOverviewAnimationSettings>>;
(...skipping 11 matching lines...) Expand all
58 // |title_height| tall in the transformed window. 59 // |title_height| tall in the transformed window.
59 static gfx::Rect ShrinkRectToFitPreservingAspectRatio(const gfx::Rect& rect, 60 static gfx::Rect ShrinkRectToFitPreservingAspectRatio(const gfx::Rect& rect,
60 const gfx::Rect& bounds, 61 const gfx::Rect& bounds,
61 int top_view_inset, 62 int top_view_inset,
62 int title_height); 63 int title_height);
63 64
64 // Returns the transform turning |src_rect| into |dst_rect|. 65 // Returns the transform turning |src_rect| into |dst_rect|.
65 static gfx::Transform GetTransformForRect(const gfx::Rect& src_rect, 66 static gfx::Transform GetTransformForRect(const gfx::Rect& src_rect,
66 const gfx::Rect& dst_rect); 67 const gfx::Rect& dst_rect);
67 68
68 explicit ScopedTransformOverviewWindow(aura::Window* window); 69 ScopedTransformOverviewWindow(WindowSelectorItem* selector_item,
70 aura::Window* window);
69 ~ScopedTransformOverviewWindow() override; 71 ~ScopedTransformOverviewWindow() override;
70 72
71 // Starts an animation sequence which will use animation settings specified by 73 // Starts an animation sequence which will use animation settings specified by
72 // |animation_type|. The |animation_settings| container is populated with 74 // |animation_type|. The |animation_settings| container is populated with
73 // scoped entities and the container should be destroyed at the end of the 75 // scoped entities and the container should be destroyed at the end of the
74 // animation sequence. 76 // animation sequence.
75 // 77 //
76 // Example: 78 // Example:
77 // ScopedTransformOverviewWindow overview_window(window); 79 // ScopedTransformOverviewWindow overview_window(window);
78 // ScopedTransformOverviewWindow::ScopedAnimationSettings scoped_settings; 80 // ScopedTransformOverviewWindow::ScopedAnimationSettings scoped_settings;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 friend class WindowSelectorTest; 160 friend class WindowSelectorTest;
159 161
160 // Closes the window managed by |this|. 162 // Closes the window managed by |this|.
161 void CloseWidget(); 163 void CloseWidget();
162 164
163 void CreateMirrorWindowForMinimizedState(); 165 void CreateMirrorWindowForMinimizedState();
164 166
165 // Makes Close() execute synchronously when used in tests. 167 // Makes Close() execute synchronously when used in tests.
166 static void SetImmediateCloseForTests(); 168 static void SetImmediateCloseForTests();
167 169
170 // A weak pointer to the window selector item that owns the transform window.
171 WindowSelectorItem* selector_item_;
172
168 // A weak pointer to the real window in the overview. 173 // A weak pointer to the real window in the overview.
169 aura::Window* window_; 174 aura::Window* window_;
170 175
171 // Original |window_|'s shape, if it was set on the window. 176 // Original |window_|'s shape, if it was set on the window.
172 std::unique_ptr<SkRegion> original_window_shape_; 177 std::unique_ptr<SkRegion> original_window_shape_;
173 178
174 // True after the |original_window_shape_| has been set or after it has 179 // True after the |original_window_shape_| has been set or after it has
175 // been determined that window shape was not originally set on the |window_|. 180 // been determined that window shape was not originally set on the |window_|.
176 bool determined_original_window_shape_; 181 bool determined_original_window_shape_;
177 182
(...skipping 13 matching lines...) Expand all
191 std::unique_ptr<views::Widget> minimized_widget_; 196 std::unique_ptr<views::Widget> minimized_widget_;
192 197
193 base::WeakPtrFactory<ScopedTransformOverviewWindow> weak_ptr_factory_; 198 base::WeakPtrFactory<ScopedTransformOverviewWindow> weak_ptr_factory_;
194 199
195 DISALLOW_COPY_AND_ASSIGN(ScopedTransformOverviewWindow); 200 DISALLOW_COPY_AND_ASSIGN(ScopedTransformOverviewWindow);
196 }; 201 };
197 202
198 } // namespace ash 203 } // namespace ash
199 204
200 #endif // ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_ 205 #endif // ASH_WM_OVERVIEW_SCOPED_TRANSFORM_OVERVIEW_WINDOW_H_
OLDNEW
« no previous file with comments | « ash/wm/overview/scoped_overview_animation_settings.cc ('k') | ash/wm/overview/scoped_transform_overview_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698