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

Side by Side Diff: ash/wm/dock/docked_window_resizer.h

Issue 23431009: Windows docking should get triggered by pressing against the screen edge (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Windows docking should get triggered by pressing against the screen edge Created 7 years, 3 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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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_DOCK_DOCK_WINDOW_RESIZER_H_ 5 #ifndef ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_
6 #define ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_ 6 #define ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_
7 7
8 #include "ash/wm/dock/dock_types.h" 8 #include "ash/wm/dock/dock_types.h"
9 #include "ash/wm/window_resizer.h" 9 #include "ash/wm/window_resizer.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 12
13 namespace gfx { 13 namespace gfx {
14 class Point; 14 class Point;
15 class Rect; 15 class Rect;
16 } 16 }
17 17
18 namespace aura { 18 namespace aura {
19 class RootWindow; 19 class RootWindow;
20 } 20 }
21 21
22 namespace ash { 22 namespace ash {
23 namespace internal { 23 namespace internal {
24 24
25 class DockedWindowLayoutManager; 25 class DockedWindowLayoutManager;
26 class PhantomWindowController;
27 26
28 // DockWindowResizer is used by ToplevelWindowEventFilter to handle dragging, 27 // DockWindowResizer is used by ToplevelWindowEventFilter to handle dragging,
29 // moving or resizing of a window while it is docked to the side of a screen. 28 // moving or resizing of a window while it is docked to the side of a screen.
30 class ASH_EXPORT DockedWindowResizer : public WindowResizer { 29 class ASH_EXPORT DockedWindowResizer : public WindowResizer {
31 public: 30 public:
32 virtual ~DockedWindowResizer(); 31 virtual ~DockedWindowResizer();
33 32
34 // Creates a new DockWindowResizer. The caller takes ownership of the 33 // Creates a new DockWindowResizer. The caller takes ownership of the
35 // returned object. The ownership of |next_window_resizer| is taken by the 34 // returned object. The ownership of |next_window_resizer| is taken by the
36 // returned object. Returns NULL if not resizable. 35 // returned object. Returns NULL if not resizable.
(...skipping 10 matching lines...) Expand all
47 virtual aura::Window* GetTarget() OVERRIDE; 46 virtual aura::Window* GetTarget() OVERRIDE;
48 virtual const gfx::Point& GetInitialLocation() const OVERRIDE; 47 virtual const gfx::Point& GetInitialLocation() const OVERRIDE;
49 48
50 private: 49 private:
51 // Creates DockWindowResizer that adds the ability to attach / detach 50 // Creates DockWindowResizer that adds the ability to attach / detach
52 // windows to / from the dock. This object takes ownership of 51 // windows to / from the dock. This object takes ownership of
53 // |next_window_resizer|. 52 // |next_window_resizer|.
54 DockedWindowResizer(WindowResizer* next_window_resizer, 53 DockedWindowResizer(WindowResizer* next_window_resizer,
55 const Details& details); 54 const Details& details);
56 55
57 // Returns the side of the screen that the window should dock to or
58 // DOCKED_ALIGNMENT_NONE when the window is not on a side or when some other
59 // windows are already docked on the other side or when launcher (shelf) is
60 // aligned on the same side.
61 DockedAlignment GetDraggedWindowAlignment();
62
63 // Checks if the provided window bounds should snap to the side of a screen. 56 // Checks if the provided window bounds should snap to the side of a screen.
64 // If so the offset returned gives the necessary adjustment to snap. 57 // If so the offset returned gives the necessary adjustment to snap.
65 bool MaybeSnapToEdge(const gfx::Rect& bounds, gfx::Point* offset); 58 bool MaybeSnapToEdge(const gfx::Rect& bounds, gfx::Point* offset);
66 59
67 // Tracks the window's initial position and attachment at the start of a drag 60 // Tracks the window's initial position and attachment at the start of a drag
68 // and informs the DockLayoutManager that a drag has started if necessary. 61 // and informs the DockLayoutManager that a drag has started if necessary.
69 void StartedDragging(); 62 void StartedDragging();
70 63
71 // Informs the DockLayoutManager that the drag is complete if it was informed 64 // Informs the DockLayoutManager that the drag is complete if it was informed
72 // of the drag start. 65 // of the drag start.
73 void FinishedDragging(); 66 void FinishedDragging();
74 67
75 // Updates the bounds of the phantom window that is used as a docking hint.
76 void UpdateSnapPhantomWindow();
77
78 const Details details_; 68 const Details details_;
79 69
80 gfx::Point last_location_; 70 gfx::Point last_location_;
81 71
82 // Wraps a window resizer and adds detaching / reattaching during drags. 72 // Wraps a window resizer and adds detaching / reattaching during drags.
83 scoped_ptr<WindowResizer> next_window_resizer_; 73 scoped_ptr<WindowResizer> next_window_resizer_;
84 74
85 // Dock container window. 75 // Dock container window.
86 internal::DockedWindowLayoutManager* dock_layout_; 76 internal::DockedWindowLayoutManager* dock_layout_;
87 internal::DockedWindowLayoutManager* initial_dock_layout_; 77 internal::DockedWindowLayoutManager* initial_dock_layout_;
88 78
89 // Set to true once Drag() is invoked and the bounds of the window change. 79 // Set to true once Drag() is invoked and the bounds of the window change.
90 bool did_move_or_resize_; 80 bool did_move_or_resize_;
91 81
92 // Gives a preview of where the the window will end up.
93 scoped_ptr<PhantomWindowController> snap_phantom_window_controller_;
94
95 // Set to true if the window that is being dragged was docked before drag. 82 // Set to true if the window that is being dragged was docked before drag.
96 bool was_docked_; 83 bool was_docked_;
97 84
98 // True if the dragged window is docked during the drag. 85 // True if the dragged window is docked during the drag.
99 bool is_docked_; 86 bool is_docked_;
100 87
101 // If non-NULL the destructor sets this to true. Used to determine if this has 88 // If non-NULL the destructor sets this to true. Used to determine if this has
102 // been deleted. 89 // been deleted.
103 bool* destroyed_; 90 bool* destroyed_;
104 91
105 DISALLOW_COPY_AND_ASSIGN(DockedWindowResizer); 92 DISALLOW_COPY_AND_ASSIGN(DockedWindowResizer);
106 }; 93 };
107 94
108 } // namespace internal 95 } // namespace internal
109 } // namespace ash 96 } // namespace ash
110 97
111 #endif // ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_ 98 #endif // ASH_WM_DOCK_DOCK_WINDOW_RESIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698