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 #include "ash/drag_drop/drag_drop_controller.h" | 5 #include "ash/drag_drop/drag_drop_controller.h" |
6 | 6 |
7 #include "ash/drag_drop/drag_drop_tracker.h" | 7 #include "ash/drag_drop/drag_drop_tracker.h" |
8 #include "ash/drag_drop/drag_image_view.h" | 8 #include "ash/drag_drop/drag_image_view.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/wm/coordinate_conversion.h" | 10 #include "ash/wm/coordinate_conversion.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
99 int DragDropController::StartDragAndDrop( | 99 int DragDropController::StartDragAndDrop( |
100 const ui::OSExchangeData& data, | 100 const ui::OSExchangeData& data, |
101 aura::RootWindow* root_window, | 101 aura::RootWindow* root_window, |
102 aura::Window* source_window, | 102 aura::Window* source_window, |
103 const gfx::Point& root_location, | 103 const gfx::Point& root_location, |
104 int operation, | 104 int operation, |
105 ui::DragDropTypes::DragEventSource source) { | 105 ui::DragDropTypes::DragEventSource source) { |
106 if (IsDragDropInProgress()) | 106 if (IsDragDropInProgress()) |
107 return 0; | 107 return 0; |
108 | 108 |
109 #if defined(OS_WIN) | |
110 NOTIMPLEMENTED(); | |
111 return 0; | |
112 #else | |
113 // TODO! | |
Ben Goodger (Google)
2012/12/07 22:00:26
let's make this TODO(win_ash) or TODO(cpu)
jam
2012/12/07 22:07:29
Done. Also added comment about two possible approa
| |
109 const ui::OSExchangeDataProviderAura& provider = | 114 const ui::OSExchangeDataProviderAura& provider = |
110 static_cast<const ui::OSExchangeDataProviderAura&>(data.provider()); | 115 static_cast<const ui::OSExchangeDataProviderAura&>(data.provider()); |
111 // We do not support touch drag/drop without a drag image. | 116 // We do not support touch drag/drop without a drag image. |
112 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH && | 117 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH && |
113 provider.drag_image().size().IsEmpty()) | 118 provider.drag_image().size().IsEmpty()) |
114 return 0; | 119 return 0; |
115 | 120 |
116 current_drag_event_source_ = source; | 121 current_drag_event_source_ = source; |
117 DragDropTracker* tracker = new DragDropTracker(root_window); | 122 DragDropTracker* tracker = new DragDropTracker(root_window); |
118 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) { | 123 if (source == ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH) { |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 #endif // !defined(OS_MACOSX) | 178 #endif // !defined(OS_MACOSX) |
174 | 179 |
175 if (!cancel_animation_.get() || !cancel_animation_->is_animating() || | 180 if (!cancel_animation_.get() || !cancel_animation_->is_animating() || |
176 !pending_long_tap_.get()) { | 181 !pending_long_tap_.get()) { |
177 // If drag cancel animation is running, this cleanup is done when the | 182 // If drag cancel animation is running, this cleanup is done when the |
178 // animation completes. | 183 // animation completes. |
179 if (drag_source_window_) | 184 if (drag_source_window_) |
180 drag_source_window_->RemoveObserver(this); | 185 drag_source_window_->RemoveObserver(this); |
181 drag_source_window_ = NULL; | 186 drag_source_window_ = NULL; |
182 } | 187 } |
188 #endif | |
183 | 189 |
184 return drag_operation_; | 190 return drag_operation_; |
185 } | 191 } |
186 | 192 |
187 void DragDropController::DragUpdate(aura::Window* target, | 193 void DragDropController::DragUpdate(aura::Window* target, |
188 const ui::LocatedEvent& event) { | 194 const ui::LocatedEvent& event) { |
189 aura::client::DragDropDelegate* delegate = NULL; | 195 aura::client::DragDropDelegate* delegate = NULL; |
190 if (target != drag_window_) { | 196 if (target != drag_window_) { |
191 if (drag_window_) { | 197 if (drag_window_) { |
192 if ((delegate = aura::client::GetDragDropDelegate(drag_window_))) | 198 if ((delegate = aura::client::GetDragDropDelegate(drag_window_))) |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
490 drag_window_->RemoveObserver(this); | 496 drag_window_->RemoveObserver(this); |
491 drag_window_ = NULL; | 497 drag_window_ = NULL; |
492 drag_data_ = NULL; | 498 drag_data_ = NULL; |
493 // Cleanup can be called again while deleting DragDropTracker, so use Pass | 499 // Cleanup can be called again while deleting DragDropTracker, so use Pass |
494 // instead of reset to avoid double free. | 500 // instead of reset to avoid double free. |
495 drag_drop_tracker_.Pass(); | 501 drag_drop_tracker_.Pass(); |
496 } | 502 } |
497 | 503 |
498 } // namespace internal | 504 } // namespace internal |
499 } // namespace ash | 505 } // namespace ash |
OLD | NEW |