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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 break; | 222 break; |
223 default: | 223 default: |
224 // We could also reach here because RootWindow may sometimes generate a | 224 // We could also reach here because RootWindow may sometimes generate a |
225 // bunch of fake mouse events | 225 // bunch of fake mouse events |
226 // (aura::RootWindow::PostMouseMoveEventAfterWindowChange). | 226 // (aura::RootWindow::PostMouseMoveEventAfterWindowChange). |
227 break; | 227 break; |
228 } | 228 } |
229 return true; | 229 return true; |
230 } | 230 } |
231 | 231 |
232 ui::TouchStatus DragDropController::PreHandleTouchEvent( | 232 ui::EventResult DragDropController::PreHandleTouchEvent( |
233 aura::Window* target, | 233 aura::Window* target, |
234 ui::TouchEvent* event) { | 234 ui::TouchEvent* event) { |
235 // TODO(sad): Also check for the touch-id. | 235 // TODO(sad): Also check for the touch-id. |
236 // TODO(varunjain): Add code for supporting drag-and-drop across displays | 236 // TODO(varunjain): Add code for supporting drag-and-drop across displays |
237 // (http://crbug.com/114755). | 237 // (http://crbug.com/114755). |
238 if (!IsDragDropInProgress()) | 238 if (!IsDragDropInProgress()) |
239 return ui::TOUCH_STATUS_UNKNOWN; | 239 return ui::ER_UNHANDLED; |
240 switch (event->type()) { | 240 switch (event->type()) { |
241 case ui::ET_TOUCH_MOVED: | 241 case ui::ET_TOUCH_MOVED: |
242 DragUpdate(target, *event); | 242 DragUpdate(target, *event); |
243 break; | 243 break; |
244 case ui::ET_TOUCH_RELEASED: | 244 case ui::ET_TOUCH_RELEASED: |
245 Drop(target, *event); | 245 Drop(target, *event); |
246 break; | 246 break; |
247 case ui::ET_TOUCH_CANCELLED: | 247 case ui::ET_TOUCH_CANCELLED: |
248 DragCancel(); | 248 DragCancel(); |
249 break; | 249 break; |
250 default: | 250 default: |
251 return ui::TOUCH_STATUS_UNKNOWN; | 251 return ui::ER_UNHANDLED; |
252 } | 252 } |
253 return ui::TOUCH_STATUS_CONTINUE; | 253 return ui::ER_CONSUMED; |
254 } | 254 } |
255 | 255 |
256 ui::EventResult DragDropController::PreHandleGestureEvent( | 256 ui::EventResult DragDropController::PreHandleGestureEvent( |
257 aura::Window* target, | 257 aura::Window* target, |
258 ui::GestureEvent* event) { | 258 ui::GestureEvent* event) { |
259 return ui::ER_UNHANDLED; | 259 return ui::ER_UNHANDLED; |
260 } | 260 } |
261 | 261 |
262 void DragDropController::OnWindowDestroyed(aura::Window* window) { | 262 void DragDropController::OnWindowDestroyed(aura::Window* window) { |
263 if (drag_window_ == window) { | 263 if (drag_window_ == window) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 drag_window_->RemoveObserver(this); | 298 drag_window_->RemoveObserver(this); |
299 drag_window_ = NULL; | 299 drag_window_ = NULL; |
300 drag_data_ = NULL; | 300 drag_data_ = NULL; |
301 // Cleanup can be called again while deleting DragDropTracker, so use Pass | 301 // Cleanup can be called again while deleting DragDropTracker, so use Pass |
302 // instead of reset to avoid double free. | 302 // instead of reset to avoid double free. |
303 drag_drop_tracker_.Pass(); | 303 drag_drop_tracker_.Pass(); |
304 } | 304 } |
305 | 305 |
306 } // namespace internal | 306 } // namespace internal |
307 } // namespace ash | 307 } // namespace ash |
OLD | NEW |