| 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_COMMON_WM_WORKSPACE_WORKSPACE_WINDOW_RESIZER_H_ | 5 #ifndef ASH_COMMON_WM_WORKSPACE_WORKSPACE_WINDOW_RESIZER_H_ |
| 6 #define ASH_COMMON_WM_WORKSPACE_WORKSPACE_WINDOW_RESIZER_H_ | 6 #define ASH_COMMON_WM_WORKSPACE_WORKSPACE_WINDOW_RESIZER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "ash/common/wm/window_resizer.h" | 13 #include "ash/common/wm/window_resizer.h" |
| 14 #include "ash/common/wm/workspace/magnetism_matcher.h" | 14 #include "ash/common/wm/workspace/magnetism_matcher.h" |
| 15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "ui/aura/window_tracker.h" | 18 #include "ui/aura/window_tracker.h" |
| 19 | 19 |
| 20 namespace ash { | 20 namespace ash { |
| 21 class DockedWindowLayoutManager; | |
| 22 class PhantomWindowController; | 21 class PhantomWindowController; |
| 23 class TwoStepEdgeCycler; | 22 class TwoStepEdgeCycler; |
| 24 class WindowSize; | 23 class WindowSize; |
| 25 class WmShell; | 24 class WmShell; |
| 26 | 25 |
| 27 namespace wm { | 26 namespace wm { |
| 28 class WindowState; | 27 class WindowState; |
| 29 } | 28 } |
| 30 | 29 |
| 31 // WindowResizer implementation for workspaces. This enforces that windows are | 30 // WindowResizer implementation for workspaces. This enforces that windows are |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 // Returns the edge to which the window should be snapped to if the user does | 148 // Returns the edge to which the window should be snapped to if the user does |
| 150 // no more dragging. SNAP_NONE is returned if the window should not be | 149 // no more dragging. SNAP_NONE is returned if the window should not be |
| 151 // snapped. | 150 // snapped. |
| 152 SnapType GetSnapType(const gfx::Point& location) const; | 151 SnapType GetSnapType(const gfx::Point& location) const; |
| 153 | 152 |
| 154 // Returns true if |bounds_in_parent| are valid bounds for snapped state type | 153 // Returns true if |bounds_in_parent| are valid bounds for snapped state type |
| 155 // |snapped_type|. | 154 // |snapped_type|. |
| 156 bool AreBoundsValidSnappedBounds(wm::WindowStateType snapped_type, | 155 bool AreBoundsValidSnappedBounds(wm::WindowStateType snapped_type, |
| 157 const gfx::Rect& bounds_in_parent) const; | 156 const gfx::Rect& bounds_in_parent) const; |
| 158 | 157 |
| 159 // Docks or undocks the dragged window. | |
| 160 void SetDraggedWindowDocked(bool should_dock); | |
| 161 | |
| 162 wm::WindowState* window_state() { return window_state_; } | 158 wm::WindowState* window_state() { return window_state_; } |
| 163 | 159 |
| 164 const std::vector<WmWindow*> attached_windows_; | 160 const std::vector<WmWindow*> attached_windows_; |
| 165 | 161 |
| 166 WmShell* shell_; | 162 WmShell* shell_; |
| 167 | 163 |
| 168 // Returns the currently used instance for test. | 164 // Returns the currently used instance for test. |
| 169 static WorkspaceWindowResizer* GetInstanceForTest(); | 165 static WorkspaceWindowResizer* GetInstanceForTest(); |
| 170 | 166 |
| 171 bool did_lock_cursor_; | 167 bool did_lock_cursor_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 183 // Sum of the minimum sizes of the attached windows. | 179 // Sum of the minimum sizes of the attached windows. |
| 184 int total_min_; | 180 int total_min_; |
| 185 | 181 |
| 186 // Sum of the sizes in |initial_size_|. | 182 // Sum of the sizes in |initial_size_|. |
| 187 int total_initial_size_; | 183 int total_initial_size_; |
| 188 | 184 |
| 189 // Gives a previews of where the the window will end up. Only used if there | 185 // Gives a previews of where the the window will end up. Only used if there |
| 190 // is a grid and the caption is being dragged. | 186 // is a grid and the caption is being dragged. |
| 191 std::unique_ptr<PhantomWindowController> snap_phantom_window_controller_; | 187 std::unique_ptr<PhantomWindowController> snap_phantom_window_controller_; |
| 192 | 188 |
| 193 // Used to determine whether the window should be snapped or docked when | 189 // Used to determine whether the window should be snapped when the user drags |
| 194 // the user drags a window to the edge of the screen. | 190 // a window to the edge of the screen. |
| 195 std::unique_ptr<TwoStepEdgeCycler> edge_cycler_; | 191 std::unique_ptr<TwoStepEdgeCycler> edge_cycler_; |
| 196 | 192 |
| 197 // The edge to which the window should be snapped to at the end of the drag. | 193 // The edge to which the window should be snapped to at the end of the drag. |
| 198 SnapType snap_type_; | 194 SnapType snap_type_; |
| 199 | 195 |
| 200 // Number of mouse moves since the last bounds change. Only used for phantom | 196 // Number of mouse moves since the last bounds change. Only used for phantom |
| 201 // placement to track when the mouse is moved while pushed against the edge of | 197 // placement to track when the mouse is moved while pushed against the edge of |
| 202 // the screen. | 198 // the screen. |
| 203 int num_mouse_moves_since_bounds_change_; | 199 int num_mouse_moves_since_bounds_change_; |
| 204 | 200 |
| 205 // The mouse location passed to Drag(). | 201 // The mouse location passed to Drag(). |
| 206 gfx::Point last_mouse_location_; | 202 gfx::Point last_mouse_location_; |
| 207 | 203 |
| 208 // Window the drag has magnetically attached to. | 204 // Window the drag has magnetically attached to. |
| 209 WmWindow* magnetism_window_; | 205 WmWindow* magnetism_window_; |
| 210 | 206 |
| 211 // Used to verify |magnetism_window_| is still valid. | 207 // Used to verify |magnetism_window_| is still valid. |
| 212 aura::WindowTracker window_tracker_; | 208 aura::WindowTracker window_tracker_; |
| 213 | 209 |
| 214 // If |magnetism_window_| is non-NULL this indicates how the two windows | 210 // If |magnetism_window_| is non-NULL this indicates how the two windows |
| 215 // should attach. | 211 // should attach. |
| 216 MatchedEdge magnetism_edge_; | 212 MatchedEdge magnetism_edge_; |
| 217 | 213 |
| 218 // Dock container window layout manager. | |
| 219 DockedWindowLayoutManager* dock_layout_; | |
| 220 | |
| 221 // Used to determine if this has been deleted during a drag such as when a tab | 214 // Used to determine if this has been deleted during a drag such as when a tab |
| 222 // gets dragged into another browser window. | 215 // gets dragged into another browser window. |
| 223 base::WeakPtrFactory<WorkspaceWindowResizer> weak_ptr_factory_; | 216 base::WeakPtrFactory<WorkspaceWindowResizer> weak_ptr_factory_; |
| 224 | 217 |
| 225 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); | 218 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); |
| 226 }; | 219 }; |
| 227 | 220 |
| 228 } // namespace ash | 221 } // namespace ash |
| 229 | 222 |
| 230 #endif // ASH_COMMON_WM_WORKSPACE_WORKSPACE_WINDOW_RESIZER_H_ | 223 #endif // ASH_COMMON_WM_WORKSPACE_WORKSPACE_WINDOW_RESIZER_H_ |
| OLD | NEW |