OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_WORKSPACE_WINDOW_RESIZER_H_ | 5 #ifndef ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ |
6 #define ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ | 6 #define ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/wm/window_resizer.h" | 10 #include "ash/wm/window_resizer.h" |
11 #include "ash/wm/workspace/magnetism_matcher.h" | 11 #include "ash/wm/workspace/magnetism_matcher.h" |
| 12 #include "ash/wm/workspace/snap_types.h" |
12 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
13 #include "base/gtest_prod_util.h" | 14 #include "base/gtest_prod_util.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "ui/aura/window_tracker.h" | 16 #include "ui/aura/window_tracker.h" |
16 | 17 |
17 namespace ash { | 18 namespace ash { |
18 namespace internal { | 19 namespace internal { |
19 | 20 |
20 class PhantomWindowController; | 21 class PhantomWindowController; |
21 class SnapSizer; | 22 class SnapSizer; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 65 |
65 private: | 66 private: |
66 WorkspaceWindowResizer(const Details& details, | 67 WorkspaceWindowResizer(const Details& details, |
67 const std::vector<aura::Window*>& attached_windows); | 68 const std::vector<aura::Window*>& attached_windows); |
68 | 69 |
69 private: | 70 private: |
70 FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, CancelSnapPhantom); | 71 FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, CancelSnapPhantom); |
71 FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, PhantomSnapMaxSize); | 72 FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, PhantomSnapMaxSize); |
72 FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, PhantomWindowShow); | 73 FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, PhantomWindowShow); |
73 | 74 |
74 // Type of snapping. | |
75 enum SnapType { | |
76 // Snap to the left/right edge of the screen. | |
77 SNAP_LEFT_EDGE, | |
78 SNAP_RIGHT_EDGE, | |
79 | |
80 // No snap position. | |
81 SNAP_NONE | |
82 }; | |
83 | |
84 // Returns the final bounds to place the window at. This differs from | 75 // Returns the final bounds to place the window at. This differs from |
85 // the current when snapping. | 76 // the current when snapping. |
86 gfx::Rect GetFinalBounds(const gfx::Rect& bounds) const; | 77 gfx::Rect GetFinalBounds(const gfx::Rect& bounds) const; |
87 | 78 |
88 // Lays out the attached windows. |bounds| is the bounds of the main window. | 79 // Lays out the attached windows. |bounds| is the bounds of the main window. |
89 void LayoutAttachedWindows(gfx::Rect* bounds); | 80 void LayoutAttachedWindows(gfx::Rect* bounds); |
90 | 81 |
91 // Calculates the new sizes of the attached windows, given that the main | 82 // Calculates the new sizes of the attached windows, given that the main |
92 // window has been resized (along the primary axis) by |delta|. | 83 // window has been resized (along the primary axis) by |delta|. |
93 // |available_size| is the maximum length of the space that the attached | 84 // |available_size| is the maximum length of the space that the attached |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 // Window the drag has magnetically attached to. | 195 // Window the drag has magnetically attached to. |
205 aura::Window* magnetism_window_; | 196 aura::Window* magnetism_window_; |
206 | 197 |
207 // Used to verify |magnetism_window_| is still valid. | 198 // Used to verify |magnetism_window_| is still valid. |
208 aura::WindowTracker window_tracker_; | 199 aura::WindowTracker window_tracker_; |
209 | 200 |
210 // If |magnetism_window_| is non-NULL this indicates how the two windows | 201 // If |magnetism_window_| is non-NULL this indicates how the two windows |
211 // should attach. | 202 // should attach. |
212 MatchedEdge magnetism_edge_; | 203 MatchedEdge magnetism_edge_; |
213 | 204 |
| 205 // If non-NULL the destructor sets this to true. Used to determine if this has |
| 206 // been deleted. |
| 207 bool* destroyed_; |
| 208 |
214 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); | 209 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); |
215 }; | 210 }; |
216 | 211 |
217 } // namespace internal | 212 } // namespace internal |
218 } // namespace ash | 213 } // namespace ash |
219 | 214 |
220 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ | 215 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ |
OLD | NEW |