Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: ash/wm/workspace/workspace_window_resizer.h

Issue 1127133003: Adjusts dragging logic to be less likely to trigger false positive switch from snapping to docking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "ui/aura/window_tracker.h" 16 #include "ui/aura/window_tracker.h"
17 17
18 namespace ash { 18 namespace ash {
19 class DockedWindowLayoutManager; 19 class DockedWindowLayoutManager;
20 class PhantomWindowController; 20 class PhantomWindowController;
21 class TwoStepEdgeCycler; 21 class TwoStepEdgeCycler;
22 class WindowSize; 22 class WindowSize;
23 23
24 namespace wm { 24 namespace wm {
25 class WindowState; 25 class WindowState;
26 } 26 }
27 27
28 // The edge to which the window should be snapped at the end of the drag.
29 enum SnapType { SNAP_LEFT, SNAP_RIGHT, SNAP_NONE };
30
28 // WindowResizer implementation for workspaces. This enforces that windows are 31 // WindowResizer implementation for workspaces. This enforces that windows are
29 // not allowed to vertically move or resize outside of the work area. As windows 32 // not allowed to vertically move or resize outside of the work area. As windows
30 // are moved outside the work area they are shrunk. We remember the height of 33 // are moved outside the work area they are shrunk. We remember the height of
31 // the window before it was moved so that if the window is again moved up we 34 // the window before it was moved so that if the window is again moved up we
32 // attempt to restore the old height. 35 // attempt to restore the old height.
33 class ASH_EXPORT WorkspaceWindowResizer : public WindowResizer { 36 class ASH_EXPORT WorkspaceWindowResizer : public WindowResizer {
34 public: 37 public:
35 // When dragging an attached window this is the min size we'll make sure is 38 // When dragging an attached window this is the min size we'll make sure is
36 // visible. In the vertical direction we take the max of this and that from 39 // visible. In the vertical direction we take the max of this and that from
37 // the delegate. 40 // the delegate.
(...skipping 22 matching lines...) Expand all
60 void CompleteDrag() override; 63 void CompleteDrag() override;
61 void RevertDrag() override; 64 void RevertDrag() override;
62 65
63 private: 66 private:
64 WorkspaceWindowResizer(wm::WindowState* window_state, 67 WorkspaceWindowResizer(wm::WindowState* window_state,
65 const std::vector<aura::Window*>& attached_windows); 68 const std::vector<aura::Window*>& attached_windows);
66 69
67 private: 70 private:
68 friend class WorkspaceWindowResizerTest; 71 friend class WorkspaceWindowResizerTest;
69 72
70 // The edge to which the window should be snapped at the end of the drag.
71 enum SnapType {
72 SNAP_LEFT,
73 SNAP_RIGHT,
74 SNAP_NONE
75 };
76
77 // Lays out the attached windows. |bounds| is the bounds of the main window. 73 // Lays out the attached windows. |bounds| is the bounds of the main window.
78 void LayoutAttachedWindows(gfx::Rect* bounds); 74 void LayoutAttachedWindows(gfx::Rect* bounds);
79 75
80 // Calculates the new sizes of the attached windows, given that the main 76 // Calculates the new sizes of the attached windows, given that the main
81 // window has been resized (along the primary axis) by |delta|. 77 // window has been resized (along the primary axis) by |delta|.
82 // |available_size| is the maximum length of the space that the attached 78 // |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 79 // 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). 80 // 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 81 // Populates |sizes| with the desired sizes of the attached windows, and
86 // returns the number of pixels that couldn't be allocated to the attached 82 // returns the number of pixels that couldn't be allocated to the attached
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 // Used to determine if this has been deleted during a drag such as when a tab 218 // Used to determine if this has been deleted during a drag such as when a tab
223 // gets dragged into another browser window. 219 // gets dragged into another browser window.
224 base::WeakPtrFactory<WorkspaceWindowResizer> weak_ptr_factory_; 220 base::WeakPtrFactory<WorkspaceWindowResizer> weak_ptr_factory_;
225 221
226 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer); 222 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowResizer);
227 }; 223 };
228 224
229 } // namespace ash 225 } // namespace ash
230 226
231 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_ 227 #endif // ASH_WM_WORKSPACE_WINDOW_RESIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698