OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef ASH_WM_DRAG_WINDOW_RESIZER_H_ |
| 6 #define ASH_WM_DRAG_WINDOW_RESIZER_H_ |
| 7 |
| 8 #include "ash/wm/window_resizer.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/gtest_prod_util.h" |
| 11 #include "ui/gfx/point.h" |
| 12 |
| 13 namespace ash { |
| 14 namespace internal { |
| 15 |
| 16 class DragWindowController; |
| 17 |
| 18 // DragWindowResizer is a decorator of WindowResizer and adds the ability to |
| 19 // drag windows across displays. |
| 20 class ASH_EXPORT DragWindowResizer : public WindowResizer { |
| 21 public: |
| 22 virtual ~DragWindowResizer(); |
| 23 |
| 24 // Creates a new DragWindowResizer. The caller takes ownership of the |
| 25 // returned object. The ownership of |window_resizer| is taken by the |
| 26 // returned object. Returns NULL if not resizable. |
| 27 static DragWindowResizer* Create(WindowResizer* window_resizer, |
| 28 aura::Window* window, |
| 29 const gfx::Point& location, |
| 30 int window_component); |
| 31 |
| 32 // WindowResizer overides: |
| 33 virtual void Drag(const gfx::Point& location, int event_flags) OVERRIDE; |
| 34 virtual void CompleteDrag(int event_flags) OVERRIDE; |
| 35 virtual void RevertDrag() OVERRIDE; |
| 36 virtual aura::Window* GetTarget() OVERRIDE; |
| 37 |
| 38 const gfx::Point& GetInitialLocationInParentForTest() const { |
| 39 return details_.initial_location_in_parent; |
| 40 } |
| 41 |
| 42 private: |
| 43 FRIEND_TEST_ALL_PREFIXES(DragWindowResizerTest, DragWindowController); |
| 44 |
| 45 // Creates DragWindowResizer that adds the ability of dragging windows across |
| 46 // displays to |window_resizer|. This object takes the ownership of |
| 47 // |window_resizer|. |
| 48 explicit DragWindowResizer(WindowResizer* window_resizer, |
| 49 const Details& details); |
| 50 |
| 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()|. |
| 53 void UpdateDragWindow(const gfx::Rect& bounds, bool in_original_root); |
| 54 |
| 55 // Returns true if we should allow the mouse pointer to warp. |
| 56 bool ShouldAllowMouseWarp(); |
| 57 |
| 58 scoped_ptr<WindowResizer> window_resizer_; |
| 59 |
| 60 // Shows a semi-transparent image of the window being dragged. |
| 61 scoped_ptr<DragWindowController> drag_window_controller_; |
| 62 |
| 63 const Details details_; |
| 64 |
| 65 gfx::Point last_mouse_location_; |
| 66 |
| 67 // If non-NULL the destructor sets this to true. Used to determine if this has |
| 68 // been deleted. |
| 69 bool* destroyed_; |
| 70 |
| 71 DISALLOW_COPY_AND_ASSIGN(DragWindowResizer); |
| 72 }; |
| 73 |
| 74 } // namespace internal |
| 75 } // namespace aura |
| 76 |
| 77 #endif // ASH_WM_DRAG_WINDOW_RESIZER_H_ |
OLD | NEW |