| 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 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. | 5 #define _USE_MATH_DEFINES // For VC++ to get M_PI. This has to be first. |
| 6 | 6 |
| 7 #include "ui/views/view.h" | 7 #include "ui/views/view.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <cmath> | 10 #include <cmath> |
| (...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 return ui::DragDropTypes::DRAG_NONE; | 1278 return ui::DragDropTypes::DRAG_NONE; |
| 1279 } | 1279 } |
| 1280 | 1280 |
| 1281 void View::OnDragExited() { | 1281 void View::OnDragExited() { |
| 1282 } | 1282 } |
| 1283 | 1283 |
| 1284 int View::OnPerformDrop(const ui::DropTargetEvent& event) { | 1284 int View::OnPerformDrop(const ui::DropTargetEvent& event) { |
| 1285 return ui::DragDropTypes::DRAG_NONE; | 1285 return ui::DragDropTypes::DRAG_NONE; |
| 1286 } | 1286 } |
| 1287 | 1287 |
| 1288 void View::OnDragStarted(const ui::LocatedEvent& event) { |
| 1289 } |
| 1290 |
| 1288 void View::OnDragDone() { | 1291 void View::OnDragDone() { |
| 1289 } | 1292 } |
| 1290 | 1293 |
| 1291 // static | 1294 // static |
| 1292 bool View::ExceededDragThreshold(const gfx::Vector2d& delta) { | 1295 bool View::ExceededDragThreshold(const gfx::Vector2d& delta) { |
| 1293 return (abs(delta.x()) > GetHorizontalDragThreshold() || | 1296 return (abs(delta.x()) > GetHorizontalDragThreshold() || |
| 1294 abs(delta.y()) > GetVerticalDragThreshold()); | 1297 abs(delta.y()) > GetVerticalDragThreshold()); |
| 1295 } | 1298 } |
| 1296 | 1299 |
| 1297 // Accessibility---------------------------------------------------------------- | 1300 // Accessibility---------------------------------------------------------------- |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2373 Widget* widget = GetWidget(); | 2376 Widget* widget = GetWidget(); |
| 2374 // We should only start a drag from an event, implying we have a widget. | 2377 // We should only start a drag from an event, implying we have a widget. |
| 2375 DCHECK(widget); | 2378 DCHECK(widget); |
| 2376 | 2379 |
| 2377 // Don't attempt to start a drag while in the process of dragging. This is | 2380 // Don't attempt to start a drag while in the process of dragging. This is |
| 2378 // especially important on X where we can get multiple mouse move events when | 2381 // especially important on X where we can get multiple mouse move events when |
| 2379 // we start the drag. | 2382 // we start the drag. |
| 2380 if (widget->dragged_view()) | 2383 if (widget->dragged_view()) |
| 2381 return false; | 2384 return false; |
| 2382 | 2385 |
| 2386 OnDragStarted(event); |
| 2387 |
| 2383 OSExchangeData data; | 2388 OSExchangeData data; |
| 2384 WriteDragData(press_pt, &data); | 2389 WriteDragData(press_pt, &data); |
| 2385 | 2390 |
| 2386 // Message the RootView to do the drag and drop. That way if we're removed | 2391 // Message the RootView to do the drag and drop. That way if we're removed |
| 2387 // the RootView can detect it and avoid calling us back. | 2392 // the RootView can detect it and avoid calling us back. |
| 2388 gfx::Point widget_location(event.location()); | 2393 gfx::Point widget_location(event.location()); |
| 2389 ConvertPointToWidget(this, &widget_location); | 2394 ConvertPointToWidget(this, &widget_location); |
| 2390 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2395 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
| 2391 // WARNING: we may have been deleted. | 2396 // WARNING: we may have been deleted. |
| 2392 return true; | 2397 return true; |
| 2393 } | 2398 } |
| 2394 | 2399 |
| 2395 } // namespace views | 2400 } // namespace views |
| OLD | NEW |