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_DRAG_DROP_DRAG_DROP_TRACKER_H_ | 5 #ifndef ASH_DRAG_DROP_DRAG_DROP_TRACKER_H_ |
6 #define ASH_DRAG_DROP_DRAG_DROP_TRACKER_H_ | 6 #define ASH_DRAG_DROP_DRAG_DROP_TRACKER_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "ui/base/events/event.h" | 11 #include "ui/base/events/event.h" |
12 | 12 |
13 namespace aura { | 13 namespace aura { |
14 class RootWindow; | |
14 class Window; | 15 class Window; |
15 } | 16 } |
16 | 17 |
17 namespace ash { | 18 namespace ash { |
18 namespace internal { | 19 namespace internal { |
19 | 20 |
20 // Provides functions for handling drag events inside and outside the root | 21 // Provides functions for handling drag events inside and outside the root |
21 // window where drag is started. This internally sets up a capture window for | 22 // window where drag is started. This internally sets up a capture window for |
22 // tracking drag events outside the root window where drag is initiated. | 23 // tracking drag events outside the root window where drag is initiated. |
23 // ash/wm/coordinate_conversion.h is used internally and only X11 environment | 24 // ash/wm/coordinate_conversion.h is used internally and only X11 environment |
24 // is supported for now. | 25 // is supported for now. |
25 class ASH_EXPORT DragDropTracker { | 26 class ASH_EXPORT DragDropTracker { |
26 public: | 27 public: |
27 DragDropTracker(); | 28 DragDropTracker(aura::RootWindow* context_root); |
sky
2012/11/21 23:35:59
explicit
| |
28 ~DragDropTracker(); | 29 ~DragDropTracker(); |
29 | 30 |
30 // Gets the target located at |event| in the coordinates of the active root | 31 // Gets the target located at |event| in the coordinates of the active root |
31 // window. | 32 // window. |
32 aura::Window* GetTarget(const ui::LocatedEvent& event); | 33 aura::Window* GetTarget(const ui::LocatedEvent& event); |
33 | 34 |
34 // Converts the locations of |event| in the coordinates of the active root | 35 // Converts the locations of |event| in the coordinates of the active root |
35 // window to the ones in |target|'s coordinates. | 36 // window to the ones in |target|'s coordinates. |
36 // Caller takes ownership of the returned object. | 37 // Caller takes ownership of the returned object. |
37 ui::MouseEvent* ConvertMouseEvent(aura::Window* target, | 38 ui::MouseEvent* ConvertMouseEvent(aura::Window* target, |
38 const ui::MouseEvent& event); | 39 const ui::MouseEvent& event); |
39 | 40 |
40 private: | 41 private: |
41 // A window for capturing drag events while dragging. | 42 // A window for capturing drag events while dragging. |
42 scoped_ptr<aura::Window> capture_window_; | 43 scoped_ptr<aura::Window> capture_window_; |
43 | 44 |
44 DISALLOW_COPY_AND_ASSIGN(DragDropTracker); | 45 DISALLOW_COPY_AND_ASSIGN(DragDropTracker); |
45 }; | 46 }; |
46 | 47 |
47 } // namespace internal | 48 } // namespace internal |
48 } // namespace ash | 49 } // namespace ash |
49 | 50 |
50 #endif // ASH_DRAG_DROP_DRAG_DROP_TRACKER_H_ | 51 #endif // ASH_DRAG_DROP_DRAG_DROP_TRACKER_H_ |
OLD | NEW |