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 <memory> |
| 9 |
8 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
9 #include "base/callback.h" | 11 #include "base/callback.h" |
10 #include "base/macros.h" | 12 #include "base/macros.h" |
11 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
12 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
13 #include "ui/base/dragdrop/os_exchange_data.h" | 15 #include "ui/base/dragdrop/os_exchange_data.h" |
14 #include "ui/events/event_constants.h" | 16 #include "ui/events/event_constants.h" |
15 #include "ui/events/event_handler.h" | 17 #include "ui/events/event_handler.h" |
16 #include "ui/gfx/animation/animation_delegate.h" | 18 #include "ui/gfx/animation/animation_delegate.h" |
17 #include "ui/gfx/geometry/rect.h" | 19 #include "ui/gfx/geometry/rect.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 88 |
87 // Helper method to start drag widget flying back animation. | 89 // Helper method to start drag widget flying back animation. |
88 void StartCanceledAnimation(int animation_duration_ms); | 90 void StartCanceledAnimation(int animation_duration_ms); |
89 | 91 |
90 // Helper method to forward |pending_log_tap_| event to |drag_source_window_|. | 92 // Helper method to forward |pending_log_tap_| event to |drag_source_window_|. |
91 void ForwardPendingLongTap(); | 93 void ForwardPendingLongTap(); |
92 | 94 |
93 // Helper method to reset everything. | 95 // Helper method to reset everything. |
94 void Cleanup(); | 96 void Cleanup(); |
95 | 97 |
96 scoped_ptr<DragImageView> drag_image_; | 98 std::unique_ptr<DragImageView> drag_image_; |
97 gfx::Vector2d drag_image_offset_; | 99 gfx::Vector2d drag_image_offset_; |
98 const ui::OSExchangeData* drag_data_; | 100 const ui::OSExchangeData* drag_data_; |
99 int drag_operation_; | 101 int drag_operation_; |
100 | 102 |
101 // Window that is currently under the drag cursor. | 103 // Window that is currently under the drag cursor. |
102 aura::Window* drag_window_; | 104 aura::Window* drag_window_; |
103 | 105 |
104 // Starting and final bounds for the drag image for the drag cancel animation. | 106 // Starting and final bounds for the drag image for the drag cancel animation. |
105 gfx::Rect drag_image_initial_bounds_for_cancel_animation_; | 107 gfx::Rect drag_image_initial_bounds_for_cancel_animation_; |
106 gfx::Rect drag_image_final_bounds_for_cancel_animation_; | 108 gfx::Rect drag_image_final_bounds_for_cancel_animation_; |
107 | 109 |
108 scoped_ptr<gfx::LinearAnimation> cancel_animation_; | 110 std::unique_ptr<gfx::LinearAnimation> cancel_animation_; |
109 | 111 |
110 // Window that started the drag. | 112 // Window that started the drag. |
111 aura::Window* drag_source_window_; | 113 aura::Window* drag_source_window_; |
112 | 114 |
113 // Indicates whether the caller should be blocked on a drag/drop session. | 115 // Indicates whether the caller should be blocked on a drag/drop session. |
114 // Only be used for tests. | 116 // Only be used for tests. |
115 bool should_block_during_drag_drop_; | 117 bool should_block_during_drag_drop_; |
116 | 118 |
117 // Closure for quitting nested message loop. | 119 // Closure for quitting nested message loop. |
118 base::Closure quit_closure_; | 120 base::Closure quit_closure_; |
119 | 121 |
120 scoped_ptr<ash::DragDropTracker> drag_drop_tracker_; | 122 std::unique_ptr<ash::DragDropTracker> drag_drop_tracker_; |
121 scoped_ptr<DragDropTrackerDelegate> drag_drop_window_delegate_; | 123 std::unique_ptr<DragDropTrackerDelegate> drag_drop_window_delegate_; |
122 | 124 |
123 ui::DragDropTypes::DragEventSource current_drag_event_source_; | 125 ui::DragDropTypes::DragEventSource current_drag_event_source_; |
124 | 126 |
125 // Holds a synthetic long tap event to be sent to the |drag_source_window_|. | 127 // Holds a synthetic long tap event to be sent to the |drag_source_window_|. |
126 // See comment in OnGestureEvent() on why we need this. | 128 // See comment in OnGestureEvent() on why we need this. |
127 scoped_ptr<ui::GestureEvent> pending_long_tap_; | 129 std::unique_ptr<ui::GestureEvent> pending_long_tap_; |
128 | 130 |
129 base::WeakPtrFactory<DragDropController> weak_factory_; | 131 base::WeakPtrFactory<DragDropController> weak_factory_; |
130 | 132 |
131 DISALLOW_COPY_AND_ASSIGN(DragDropController); | 133 DISALLOW_COPY_AND_ASSIGN(DragDropController); |
132 }; | 134 }; |
133 | 135 |
134 } // namespace ash | 136 } // namespace ash |
135 | 137 |
136 #endif // ASH_DRAG_DROP_DRAG_DROP_CONTROLLER_H_ | 138 #endif // ASH_DRAG_DROP_DRAG_DROP_CONTROLLER_H_ |
OLD | NEW |