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" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "ui/gfx/point.h" | 12 #include "ui/gfx/point.h" |
13 | 13 |
14 namespace ash { | 14 namespace ash { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 class DragWindowController; | 17 class DragWindowController; |
18 class TrayUser; | |
19 | 18 |
20 // DragWindowResizer is a decorator of WindowResizer and adds the ability to | 19 // DragWindowResizer is a decorator of WindowResizer and adds the ability to |
21 // drag windows across displays. | 20 // drag windows across displays. |
22 class ASH_EXPORT DragWindowResizer : public WindowResizer { | 21 class ASH_EXPORT DragWindowResizer : public WindowResizer { |
23 public: | 22 public: |
24 virtual ~DragWindowResizer(); | 23 virtual ~DragWindowResizer(); |
25 | 24 |
26 // Creates a new DragWindowResizer. The caller takes ownership of the | 25 // Creates a new DragWindowResizer. The caller takes ownership of the |
27 // returned object. The ownership of |next_window_resizer| is taken by the | 26 // returned object. The ownership of |next_window_resizer| is taken by the |
28 // returned object. Returns NULL if not resizable. | 27 // returned object. Returns NULL if not resizable. |
(...skipping 14 matching lines...) Expand all Loading... |
43 explicit DragWindowResizer(WindowResizer* next_window_resizer, | 42 explicit DragWindowResizer(WindowResizer* next_window_resizer, |
44 wm::WindowState* window_state); | 43 wm::WindowState* window_state); |
45 | 44 |
46 // Updates the bounds of the phantom window for window dragging. Set true on | 45 // Updates the bounds of the phantom window for window dragging. Set true on |
47 // |in_original_root| if the pointer is still in |window()->GetRootWindow()|. | 46 // |in_original_root| if the pointer is still in |window()->GetRootWindow()|. |
48 void UpdateDragWindow(const gfx::Rect& bounds, bool in_original_root); | 47 void UpdateDragWindow(const gfx::Rect& bounds, bool in_original_root); |
49 | 48 |
50 // Returns true if we should allow the mouse pointer to warp. | 49 // Returns true if we should allow the mouse pointer to warp. |
51 bool ShouldAllowMouseWarp(); | 50 bool ShouldAllowMouseWarp(); |
52 | 51 |
53 // Get the user drop target underneath the given |point_in_screen| or NULL. | |
54 TrayUser* GetTrayUserItemAtPoint(const gfx::Point& point_in_screen); | |
55 | |
56 // Check if a completed drag might cause the window to change active desktops. | |
57 // If the call was causing a "transfer of ownership to another desktop" and it | |
58 // will return false indicating that no further processing is needed. | |
59 bool TryDraggingToNewUser(); | |
60 | |
61 scoped_ptr<WindowResizer> next_window_resizer_; | 52 scoped_ptr<WindowResizer> next_window_resizer_; |
62 | 53 |
63 // Shows a semi-transparent image of the window being dragged. | 54 // Shows a semi-transparent image of the window being dragged. |
64 scoped_ptr<DragWindowController> drag_window_controller_; | 55 scoped_ptr<DragWindowController> drag_window_controller_; |
65 | 56 |
66 gfx::Point last_mouse_location_; | 57 gfx::Point last_mouse_location_; |
67 | 58 |
68 // Current instance for use by the DragWindowResizerTest. | 59 // Current instance for use by the DragWindowResizerTest. |
69 static DragWindowResizer* instance_; | 60 static DragWindowResizer* instance_; |
70 | 61 |
71 base::WeakPtrFactory<DragWindowResizer> weak_ptr_factory_; | 62 base::WeakPtrFactory<DragWindowResizer> weak_ptr_factory_; |
72 | 63 |
73 DISALLOW_COPY_AND_ASSIGN(DragWindowResizer); | 64 DISALLOW_COPY_AND_ASSIGN(DragWindowResizer); |
74 }; | 65 }; |
75 | 66 |
76 } // namespace internal | 67 } // namespace internal |
77 } // namespace ash | 68 } // namespace ash |
78 | 69 |
79 #endif // ASH_WM_DRAG_WINDOW_RESIZER_H_ | 70 #endif // ASH_WM_DRAG_WINDOW_RESIZER_H_ |
OLD | NEW |