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_CONTROLLER_H_ | 5 #ifndef ASH_DRAG_DROP_DRAG_DROP_CONTROLLER_H_ |
6 #define ASH_DRAG_DROP_DRAG_DROP_CONTROLLER_H_ | 6 #define ASH_DRAG_DROP_DRAG_DROP_CONTROLLER_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "ui/aura/client/drag_drop_client.h" | 10 #include "ui/aura/client/drag_drop_client.h" |
11 #include "ui/aura/event_filter.h" | 11 #include "ui/aura/event_filter.h" |
12 #include "ui/aura/window_observer.h" | 12 #include "ui/aura/window_observer.h" |
13 #include "ui/base/dragdrop/os_exchange_data.h" | 13 #include "ui/base/dragdrop/os_exchange_data.h" |
14 #include "ui/base/events.h" | 14 #include "ui/base/events.h" |
15 #include "ui/compositor/layer_animation_observer.h" | 15 #include "ui/compositor/layer_animation_observer.h" |
16 #include "ui/gfx/point.h" | 16 #include "ui/gfx/point.h" |
17 | 17 |
18 namespace aura { | 18 namespace aura { |
| 19 class RootWindow; |
19 class Window; | 20 class Window; |
20 } | 21 } |
21 | 22 |
22 namespace ui { | 23 namespace ui { |
23 class LayerAnimationSequence; | 24 class LayerAnimationSequence; |
24 } | 25 } |
25 | 26 |
26 namespace ash { | 27 namespace ash { |
27 | 28 |
28 namespace test { | 29 namespace test { |
29 class DragDropControllerTest; | 30 class DragDropControllerTest; |
30 } | 31 } |
31 | 32 |
32 namespace internal { | 33 namespace internal { |
33 | 34 |
| 35 class DragDropTracker; |
34 class DragImageView; | 36 class DragImageView; |
35 | 37 |
36 class ASH_EXPORT DragDropController | 38 class ASH_EXPORT DragDropController |
37 : public aura::client::DragDropClient, | 39 : public aura::client::DragDropClient, |
38 public aura::EventFilter, | 40 public aura::EventFilter, |
39 public ui::ImplicitAnimationObserver, | 41 public ui::ImplicitAnimationObserver, |
40 public aura::WindowObserver { | 42 public aura::WindowObserver { |
41 public: | 43 public: |
42 DragDropController(); | 44 DragDropController(); |
43 virtual ~DragDropController(); | 45 virtual ~DragDropController(); |
44 | 46 |
45 void set_should_block_during_drag_drop(bool should_block_during_drag_drop) { | 47 void set_should_block_during_drag_drop(bool should_block_during_drag_drop) { |
46 should_block_during_drag_drop_ = should_block_during_drag_drop; | 48 should_block_during_drag_drop_ = should_block_during_drag_drop; |
47 } | 49 } |
48 | 50 |
49 // Overridden from aura::client::DragDropClient: | 51 // Overridden from aura::client::DragDropClient: |
50 virtual int StartDragAndDrop(const ui::OSExchangeData& data, | 52 virtual int StartDragAndDrop(const ui::OSExchangeData& data, |
| 53 aura::RootWindow* root_window, |
51 const gfx::Point& root_location, | 54 const gfx::Point& root_location, |
52 int operation) OVERRIDE; | 55 int operation) OVERRIDE; |
53 virtual void DragUpdate(aura::Window* target, | 56 virtual void DragUpdate(aura::Window* target, |
54 const ui::LocatedEvent& event) OVERRIDE; | 57 const ui::LocatedEvent& event) OVERRIDE; |
55 virtual void Drop(aura::Window* target, | 58 virtual void Drop(aura::Window* target, |
56 const ui::LocatedEvent& event) OVERRIDE; | 59 const ui::LocatedEvent& event) OVERRIDE; |
57 virtual void DragCancel() OVERRIDE; | 60 virtual void DragCancel() OVERRIDE; |
58 virtual bool IsDragDropInProgress() OVERRIDE; | 61 virtual bool IsDragDropInProgress() OVERRIDE; |
59 virtual gfx::NativeCursor GetDragCursor() OVERRIDE; | 62 virtual gfx::NativeCursor GetDragCursor() OVERRIDE; |
60 | 63 |
(...skipping 27 matching lines...) Expand all Loading... |
88 scoped_ptr<DragImageView> drag_image_; | 91 scoped_ptr<DragImageView> drag_image_; |
89 gfx::Point drag_image_offset_; | 92 gfx::Point drag_image_offset_; |
90 const ui::OSExchangeData* drag_data_; | 93 const ui::OSExchangeData* drag_data_; |
91 int drag_operation_; | 94 int drag_operation_; |
92 gfx::NativeCursor drag_cursor_; | 95 gfx::NativeCursor drag_cursor_; |
93 | 96 |
94 // Window that is currently under the drag cursor. | 97 // Window that is currently under the drag cursor. |
95 aura::Window* drag_window_; | 98 aura::Window* drag_window_; |
96 gfx::Point drag_start_location_; | 99 gfx::Point drag_start_location_; |
97 | 100 |
98 bool drag_drop_in_progress_; | |
99 | |
100 // Indicates whether the caller should be blocked on a drag/drop session. | 101 // Indicates whether the caller should be blocked on a drag/drop session. |
101 // Only be used for tests. | 102 // Only be used for tests. |
102 bool should_block_during_drag_drop_; | 103 bool should_block_during_drag_drop_; |
103 | 104 |
104 // Closure for quitting nested message loop. | 105 // Closure for quitting nested message loop. |
105 base::Closure quit_closure_; | 106 base::Closure quit_closure_; |
106 | 107 |
| 108 scoped_ptr<ash::internal::DragDropTracker> drag_drop_tracker_; |
| 109 |
107 DISALLOW_COPY_AND_ASSIGN(DragDropController); | 110 DISALLOW_COPY_AND_ASSIGN(DragDropController); |
108 }; | 111 }; |
109 | 112 |
110 } // namespace internal | 113 } // namespace internal |
111 } // namespace ash | 114 } // namespace ash |
112 | 115 |
113 #endif // ASH_DRAG_DROP_DRAG_DROP_CONTROLLER_H_ | 116 #endif // ASH_DRAG_DROP_DRAG_DROP_CONTROLLER_H_ |
OLD | NEW |