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 "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 | 13 |
| 14 namespace aura { |
| 15 class RootWindow; |
| 16 } // namespace aura |
| 17 |
14 namespace ash { | 18 namespace ash { |
15 namespace internal { | 19 namespace internal { |
16 | 20 |
17 class PhantomWindowController; | 21 class PhantomWindowController; |
18 class SnapSizer; | 22 class SnapSizer; |
19 | 23 |
20 // WindowResizer implementation for workspaces. This enforces that windows are | 24 // WindowResizer implementation for workspaces. This enforces that windows are |
21 // not allowed to vertically move or resize outside of the work area. As windows | 25 // not allowed to vertically move or resize outside of the work area. As windows |
22 // are moved outside the work area they are shrunk. We remember the height of | 26 // are moved outside the work area they are shrunk. We remember the height of |
23 // the window before it was moved so that if the window is again moved up we | 27 // the window before it was moved so that if the window is again moved up we |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 int grid_size) const; | 102 int grid_size) const; |
99 | 103 |
100 // Returns true if the window touches the bottom edge of the work area. | 104 // Returns true if the window touches the bottom edge of the work area. |
101 bool TouchesBottomOfScreen() const; | 105 bool TouchesBottomOfScreen() const; |
102 | 106 |
103 // Returns a coordinate along the primary axis. Used to share code for | 107 // Returns a coordinate along the primary axis. Used to share code for |
104 // left/right multi window resize and top/bottom resize. | 108 // left/right multi window resize and top/bottom resize. |
105 int PrimaryAxisSize(const gfx::Size& size) const; | 109 int PrimaryAxisSize(const gfx::Size& size) const; |
106 int PrimaryAxisCoordinate(int x, int y) const; | 110 int PrimaryAxisCoordinate(int x, int y) const; |
107 | 111 |
108 // Updates the bounds of the phantom window. | 112 // Updates the bounds of the phantom window for window snapping. |
109 void UpdatePhantomWindow( | 113 void UpdateSnapPhantomWindow(const gfx::Point& location, |
110 const gfx::Point& location, | 114 const gfx::Rect& bounds, |
111 const gfx::Rect& bounds, | 115 int grid_size); |
112 int grid_size); | 116 |
| 117 // Updates the bounds of the phantom window for window dragging. |
| 118 void UpdateDragPhantomWindow(const gfx::Rect& bounds); |
113 | 119 |
114 // Restacks the windows z-order position so that one of the windows is at the | 120 // Restacks the windows z-order position so that one of the windows is at the |
115 // top of the z-order, and the rest directly underneath it. | 121 // top of the z-order, and the rest directly underneath it. |
116 void RestackWindows(); | 122 void RestackWindows(); |
117 | 123 |
118 // Returns the SnapType for the specified point. SNAP_NONE is used if no | 124 // Returns the SnapType for the specified point. SNAP_NONE is used if no |
119 // snapping should be used. | 125 // snapping should be used. |
120 SnapType GetSnapType(const gfx::Point& location) const; | 126 SnapType GetSnapType(const gfx::Point& location) const; |
121 | 127 |
122 // Returns true if we should allow the mouse pointer to warp. | 128 // Returns true if we should allow the mouse pointer to warp. |
(...skipping 27 matching lines...) Expand all Loading... |
150 std::vector<float> expand_fraction_; | 156 std::vector<float> expand_fraction_; |
151 | 157 |
152 // Sum of sizes in |min_size_|. | 158 // Sum of sizes in |min_size_|. |
153 int total_min_; | 159 int total_min_; |
154 | 160 |
155 // Sum of the sizes in |initial_size_|. | 161 // Sum of the sizes in |initial_size_|. |
156 int total_initial_size_; | 162 int total_initial_size_; |
157 | 163 |
158 // Gives a previews of where the the window will end up. Only used if there | 164 // Gives a previews of where the the window will end up. Only used if there |
159 // is a grid and the caption is being dragged. | 165 // is a grid and the caption is being dragged. |
160 scoped_ptr<PhantomWindowController> phantom_window_controller_; | 166 scoped_ptr<PhantomWindowController> snap_phantom_window_controller_; |
| 167 |
| 168 // For now, we show a phantom window on the other root window during dragging. |
| 169 // TODO(yusukes): Show a semi-transparent image (screen shot) of the window |
| 170 // instead. |
| 171 scoped_ptr<PhantomWindowController> drag_phantom_window_controller_; |
161 | 172 |
162 // Used to determine the target position of a snap. | 173 // Used to determine the target position of a snap. |
163 scoped_ptr<SnapSizer> snap_sizer_; | 174 scoped_ptr<SnapSizer> snap_sizer_; |
164 | 175 |
165 // Last SnapType. | 176 // Last SnapType. |
166 SnapType snap_type_; | 177 SnapType snap_type_; |
167 | 178 |
168 // Number of mouse moves since the last bounds change. Only used for phantom | 179 // Number of mouse moves since the last bounds change. Only used for phantom |
169 // placement to track when the mouse is moved while pushed against the edge of | 180 // placement to track when the mouse is moved while pushed against the edge of |
170 // the screen. | 181 // the screen. |
171 int num_mouse_moves_since_bounds_change_; | 182 int num_mouse_moves_since_bounds_change_; |
172 | 183 |
173 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); | 184 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); |
174 }; | 185 }; |
175 | 186 |
176 } // namespace internal | 187 } // namespace internal |
177 } // namespace ash | 188 } // namespace ash |
178 | 189 |
179 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ | 190 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ |
OLD | NEW |