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" |
| 16 #include "base/memory/weak_ptr.h" |
15 #include "ui/aura/window_tracker.h" | 17 #include "ui/aura/window_tracker.h" |
16 | 18 |
17 namespace ash { | 19 namespace ash { |
18 namespace internal { | 20 namespace internal { |
19 | 21 |
20 class PhantomWindowController; | 22 class PhantomWindowController; |
21 class SnapSizer; | 23 class SnapSizer; |
22 class WindowSize; | 24 class WindowSize; |
23 | 25 |
24 // WindowResizer implementation for workspaces. This enforces that windows are | 26 // WindowResizer implementation for workspaces. This enforces that windows are |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 66 |
65 private: | 67 private: |
66 WorkspaceWindowResizer(const Details& details, | 68 WorkspaceWindowResizer(const Details& details, |
67 const std::vector<aura::Window*>& attached_windows); | 69 const std::vector<aura::Window*>& attached_windows); |
68 | 70 |
69 private: | 71 private: |
70 FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, CancelSnapPhantom); | 72 FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, CancelSnapPhantom); |
71 FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, PhantomSnapMaxSize); | 73 FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, PhantomSnapMaxSize); |
72 FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, PhantomWindowShow); | 74 FRIEND_TEST_ALL_PREFIXES(WorkspaceWindowResizerTest, PhantomWindowShow); |
73 | 75 |
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 | 76 // Returns the final bounds to place the window at. This differs from |
85 // the current when snapping. | 77 // the current when snapping. |
86 gfx::Rect GetFinalBounds(const gfx::Rect& bounds) const; | 78 gfx::Rect GetFinalBounds(const gfx::Rect& bounds) const; |
87 | 79 |
88 // Lays out the attached windows. |bounds| is the bounds of the main window. | 80 // Lays out the attached windows. |bounds| is the bounds of the main window. |
89 void LayoutAttachedWindows(gfx::Rect* bounds); | 81 void LayoutAttachedWindows(gfx::Rect* bounds); |
90 | 82 |
91 // Calculates the new sizes of the attached windows, given that the main | 83 // Calculates the new sizes of the attached windows, given that the main |
92 // window has been resized (along the primary axis) by |delta|. | 84 // window has been resized (along the primary axis) by |delta|. |
93 // |available_size| is the maximum length of the space that the attached | 85 // |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. | 196 // Window the drag has magnetically attached to. |
205 aura::Window* magnetism_window_; | 197 aura::Window* magnetism_window_; |
206 | 198 |
207 // Used to verify |magnetism_window_| is still valid. | 199 // Used to verify |magnetism_window_| is still valid. |
208 aura::WindowTracker window_tracker_; | 200 aura::WindowTracker window_tracker_; |
209 | 201 |
210 // If |magnetism_window_| is non-NULL this indicates how the two windows | 202 // If |magnetism_window_| is non-NULL this indicates how the two windows |
211 // should attach. | 203 // should attach. |
212 MatchedEdge magnetism_edge_; | 204 MatchedEdge magnetism_edge_; |
213 | 205 |
| 206 // Used to determine if this has been deleted during a drag such as when a tab |
| 207 // gets dragged into another browser window. |
| 208 base::WeakPtrFactory<WorkspaceWindowResizer> weak_ptr_factory_; |
| 209 |
214 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); | 210 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); |
215 }; | 211 }; |
216 | 212 |
217 } // namespace internal | 213 } // namespace internal |
218 } // namespace ash | 214 } // namespace ash |
219 | 215 |
220 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ | 216 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ |
OLD | NEW |