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

Side by Side Diff: ash/wm/drag_window_resizer.h

Issue 13896026: Stick windows to sides of workspaces (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dock with zero width (drag resizer instance) Created 7 years, 6 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_DRAG_WINDOW_RESIZER_H_ 5 #ifndef ASH_WM_DRAG_WINDOW_RESIZER_H_
6 #define ASH_WM_DRAG_WINDOW_RESIZER_H_ 6 #define ASH_WM_DRAG_WINDOW_RESIZER_H_
7 7
8 #include "ash/wm/window_resizer.h" 8 #include "ash/wm/window_resizer.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/gtest_prod_util.h" 10 #include "base/gtest_prod_util.h"
(...skipping 11 matching lines...) Expand all
22 virtual ~DragWindowResizer(); 22 virtual ~DragWindowResizer();
23 23
24 // Creates a new DragWindowResizer. The caller takes ownership of the 24 // Creates a new DragWindowResizer. The caller takes ownership of the
25 // returned object. The ownership of |next_window_resizer| is taken by the 25 // returned object. The ownership of |next_window_resizer| is taken by the
26 // returned object. Returns NULL if not resizable. 26 // returned object. Returns NULL if not resizable.
27 static DragWindowResizer* Create(WindowResizer* next_window_resizer, 27 static DragWindowResizer* Create(WindowResizer* next_window_resizer,
28 aura::Window* window, 28 aura::Window* window,
29 const gfx::Point& location, 29 const gfx::Point& location,
30 int window_component); 30 int window_component);
31 31
32 // WindowResizer overides: 32 // WindowResizer:
33 virtual void Drag(const gfx::Point& location, int event_flags) OVERRIDE; 33 virtual void Drag(const gfx::Point& location, int event_flags) OVERRIDE;
34 virtual void CompleteDrag(int event_flags) OVERRIDE; 34 virtual void CompleteDrag(int event_flags) OVERRIDE;
35 virtual void RevertDrag() OVERRIDE; 35 virtual void RevertDrag() OVERRIDE;
36 virtual aura::Window* GetTarget() OVERRIDE; 36 virtual aura::Window* GetTarget() OVERRIDE;
37 37
38 const gfx::Point& GetInitialLocationInParentForTest() const { 38 protected:
39 return details_.initial_location_in_parent; 39 // WindowResizer:
40 } 40 virtual const gfx::Point& GetInitialLocationForTest() const OVERRIDE;
41 41
42 private: 42 private:
43 FRIEND_TEST_ALL_PREFIXES(DragWindowResizerTest, DragWindowController); 43 FRIEND_TEST_ALL_PREFIXES(DragWindowResizerTest, DragWindowController);
44 44
45 // Creates DragWindowResizer that adds the ability of dragging windows across 45 // Creates DragWindowResizer that adds the ability of dragging windows across
46 // displays to |next_window_resizer|. This object takes the ownership of 46 // displays to |next_window_resizer|. This object takes the ownership of
47 // |next_window_resizer|. 47 // |next_window_resizer|.
48 explicit DragWindowResizer(WindowResizer* next_window_resizer, 48 explicit DragWindowResizer(WindowResizer* next_window_resizer,
49 const Details& details); 49 const Details& details);
50 50
51 // Updates the bounds of the phantom window for window dragging. Set true on 51 // Updates the bounds of the phantom window for window dragging. Set true on
52 // |in_original_root| if the pointer is still in |window()->GetRootWindow()|. 52 // |in_original_root| if the pointer is still in |window()->GetRootWindow()|.
53 void UpdateDragWindow(const gfx::Rect& bounds, bool in_original_root); 53 void UpdateDragWindow(const gfx::Rect& bounds, bool in_original_root);
54 54
55 // Returns true if we should allow the mouse pointer to warp. 55 // Returns true if we should allow the mouse pointer to warp.
56 bool ShouldAllowMouseWarp(); 56 bool ShouldAllowMouseWarp();
57 57
58 // Returns last created instance or NULL.
59 static DragWindowResizer* instance() { return last_instance; }
60
58 scoped_ptr<WindowResizer> next_window_resizer_; 61 scoped_ptr<WindowResizer> next_window_resizer_;
59 62
60 // Shows a semi-transparent image of the window being dragged. 63 // Shows a semi-transparent image of the window being dragged.
61 scoped_ptr<DragWindowController> drag_window_controller_; 64 scoped_ptr<DragWindowController> drag_window_controller_;
62 65
63 const Details details_; 66 const Details details_;
64 67
65 gfx::Point last_mouse_location_; 68 gfx::Point last_mouse_location_;
66 69
67 // If non-NULL the destructor sets this to true. Used to determine if this has 70 // If non-NULL the destructor sets this to true. Used to determine if this has
68 // been deleted. 71 // been deleted.
69 bool* destroyed_; 72 bool* destroyed_;
70 73
74 // Last instance created - for use by the DragWindowResizerTest.
75 static DragWindowResizer* last_instance;
sky 2013/06/17 19:49:47 Why the last here? Isn't this the current instance
flackr 2013/06/17 20:02:40 Ah, my mistake, I had just recommended this to avo
varkha 2013/06/17 20:34:57 Done.
varkha 2013/06/17 20:34:57 Done.
76
71 DISALLOW_COPY_AND_ASSIGN(DragWindowResizer); 77 DISALLOW_COPY_AND_ASSIGN(DragWindowResizer);
72 }; 78 };
73 79
74 } // namespace internal 80 } // namespace internal
75 } // namespace aura 81 } // namespace aura
76 82
77 #endif // ASH_WM_DRAG_WINDOW_RESIZER_H_ 83 #endif // ASH_WM_DRAG_WINDOW_RESIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698