Chromium Code Reviews| 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_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 Loading... | |
| 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 { | |
| 39 return details_.initial_location_in_parent; | |
| 40 } | |
| 41 | |
| 42 private: | 38 private: |
| 43 FRIEND_TEST_ALL_PREFIXES(DragWindowResizerTest, DragWindowController); | 39 FRIEND_TEST_ALL_PREFIXES(DragWindowResizerTest, DragWindowController); |
| 44 | 40 |
| 41 // WindowResizer: | |
| 42 virtual const gfx::Point& GetInitialLocationForTest() const OVERRIDE; | |
| 43 | |
| 45 // Creates DragWindowResizer that adds the ability of dragging windows across | 44 // Creates DragWindowResizer that adds the ability of dragging windows across |
| 46 // displays to |next_window_resizer|. This object takes the ownership of | 45 // displays to |next_window_resizer|. This object takes the ownership of |
| 47 // |next_window_resizer|. | 46 // |next_window_resizer|. |
| 48 explicit DragWindowResizer(WindowResizer* next_window_resizer, | 47 explicit DragWindowResizer(WindowResizer* next_window_resizer, |
| 49 const Details& details); | 48 const Details& details); |
| 50 | 49 |
| 51 // Updates the bounds of the phantom window for window dragging. Set true on | 50 // 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()|. | 51 // |in_original_root| if the pointer is still in |window()->GetRootWindow()|. |
| 53 void UpdateDragWindow(const gfx::Rect& bounds, bool in_original_root); | 52 void UpdateDragWindow(const gfx::Rect& bounds, bool in_original_root); |
| 54 | 53 |
| 55 // Returns true if we should allow the mouse pointer to warp. | 54 // Returns true if we should allow the mouse pointer to warp. |
| 56 bool ShouldAllowMouseWarp(); | 55 bool ShouldAllowMouseWarp(); |
| 57 | 56 |
| 57 // return last created instance or NULL. | |
| 58 static DragWindowResizer* instance() { return instance_; } | |
|
flackr
2013/06/17 18:49:42
nit: I think we should call this last_instance() s
varkha
2013/06/17 19:05:36
Done.
| |
| 59 | |
| 58 scoped_ptr<WindowResizer> next_window_resizer_; | 60 scoped_ptr<WindowResizer> next_window_resizer_; |
| 59 | 61 |
| 60 // Shows a semi-transparent image of the window being dragged. | 62 // Shows a semi-transparent image of the window being dragged. |
| 61 scoped_ptr<DragWindowController> drag_window_controller_; | 63 scoped_ptr<DragWindowController> drag_window_controller_; |
| 62 | 64 |
| 63 const Details details_; | 65 const Details details_; |
| 64 | 66 |
| 65 gfx::Point last_mouse_location_; | 67 gfx::Point last_mouse_location_; |
| 66 | 68 |
| 67 // If non-NULL the destructor sets this to true. Used to determine if this has | 69 // If non-NULL the destructor sets this to true. Used to determine if this has |
| 68 // been deleted. | 70 // been deleted. |
| 69 bool* destroyed_; | 71 bool* destroyed_; |
| 70 | 72 |
| 73 // Last instance created - for use by the DragWindowResizerTest. | |
| 74 static DragWindowResizer* instance_; | |
| 75 | |
| 71 DISALLOW_COPY_AND_ASSIGN(DragWindowResizer); | 76 DISALLOW_COPY_AND_ASSIGN(DragWindowResizer); |
| 72 }; | 77 }; |
| 73 | 78 |
| 74 } // namespace internal | 79 } // namespace internal |
| 75 } // namespace aura | 80 } // namespace aura |
| 76 | 81 |
| 77 #endif // ASH_WM_DRAG_WINDOW_RESIZER_H_ | 82 #endif // ASH_WM_DRAG_WINDOW_RESIZER_H_ |
| OLD | NEW |