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" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 static WorkspaceWindowResizer* Create( | 54 static WorkspaceWindowResizer* Create( |
55 wm::WindowState* window_state, | 55 wm::WindowState* window_state, |
56 const std::vector<aura::Window*>& attached_windows); | 56 const std::vector<aura::Window*>& attached_windows); |
57 | 57 |
58 // WindowResizer: | 58 // WindowResizer: |
59 void Drag(const gfx::Point& location_in_parent, int event_flags) override; | 59 void Drag(const gfx::Point& location_in_parent, int event_flags) override; |
60 void CompleteDrag() override; | 60 void CompleteDrag() override; |
61 void RevertDrag() override; | 61 void RevertDrag() override; |
62 | 62 |
63 private: | 63 private: |
64 WorkspaceWindowResizer(wm::WindowState* window_state, | |
65 const std::vector<aura::Window*>& attached_windows); | |
66 | |
67 private: | |
68 friend class WorkspaceWindowResizerTest; | 64 friend class WorkspaceWindowResizerTest; |
69 | 65 |
70 // The edge to which the window should be snapped at the end of the drag. | 66 // The edge to which the window should be snapped at the end of the drag. |
71 enum SnapType { | 67 enum SnapType { SNAP_LEFT, SNAP_RIGHT, SNAP_NONE }; |
72 SNAP_LEFT, | 68 |
73 SNAP_RIGHT, | 69 WorkspaceWindowResizer(wm::WindowState* window_state, |
74 SNAP_NONE | 70 const std::vector<aura::Window*>& attached_windows); |
75 }; | |
76 | 71 |
77 // Lays out the attached windows. |bounds| is the bounds of the main window. | 72 // Lays out the attached windows. |bounds| is the bounds of the main window. |
78 void LayoutAttachedWindows(gfx::Rect* bounds); | 73 void LayoutAttachedWindows(gfx::Rect* bounds); |
79 | 74 |
80 // Calculates the new sizes of the attached windows, given that the main | 75 // Calculates the new sizes of the attached windows, given that the main |
81 // window has been resized (along the primary axis) by |delta|. | 76 // window has been resized (along the primary axis) by |delta|. |
82 // |available_size| is the maximum length of the space that the attached | 77 // |available_size| is the maximum length of the space that the attached |
83 // windows are allowed to occupy (ie: the distance between the right/bottom | 78 // windows are allowed to occupy (ie: the distance between the right/bottom |
84 // edge of the primary window and the right/bottom of the desktop area). | 79 // edge of the primary window and the right/bottom of the desktop area). |
85 // Populates |sizes| with the desired sizes of the attached windows, and | 80 // Populates |sizes| with the desired sizes of the attached windows, and |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 // Used to determine if this has been deleted during a drag such as when a tab | 217 // Used to determine if this has been deleted during a drag such as when a tab |
223 // gets dragged into another browser window. | 218 // gets dragged into another browser window. |
224 base::WeakPtrFactory<WorkspaceWindowResizer> weak_ptr_factory_; | 219 base::WeakPtrFactory<WorkspaceWindowResizer> weak_ptr_factory_; |
225 | 220 |
226 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); | 221 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); |
227 }; | 222 }; |
228 | 223 |
229 } // namespace ash | 224 } // namespace ash |
230 | 225 |
231 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ | 226 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ |
OLD | NEW |