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