| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "views/view.h" | 5 #include "views/view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #ifndef NDEBUG | 8 #ifndef NDEBUG |
| 9 #include <iostream> | 9 #include <iostream> |
| 10 #endif | 10 #endif |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 return !!context_menu_controller || result; | 480 return !!context_menu_controller || result; |
| 481 } | 481 } |
| 482 | 482 |
| 483 bool View::ProcessMouseDragged(const MouseEvent& e, DragInfo* drag_info) { | 483 bool View::ProcessMouseDragged(const MouseEvent& e, DragInfo* drag_info) { |
| 484 // Copy the field, that way if we're deleted after drag and drop no harm is | 484 // Copy the field, that way if we're deleted after drag and drop no harm is |
| 485 // done. | 485 // done. |
| 486 ContextMenuController* context_menu_controller = context_menu_controller_; | 486 ContextMenuController* context_menu_controller = context_menu_controller_; |
| 487 const bool possible_drag = drag_info->possible_drag; | 487 const bool possible_drag = drag_info->possible_drag; |
| 488 if (possible_drag && ExceededDragThreshold(drag_info->start_x - e.x(), | 488 if (possible_drag && ExceededDragThreshold(drag_info->start_x - e.x(), |
| 489 drag_info->start_y - e.y())) { | 489 drag_info->start_y - e.y())) { |
| 490 DoDrag(e, drag_info->start_x, drag_info->start_y); | 490 if (!drag_controller_ || |
| 491 drag_controller_->CanStartDrag(this, |
| 492 drag_info->start_x, |
| 493 drag_info->start_y, |
| 494 e.x(), |
| 495 e.y())) |
| 496 DoDrag(e, drag_info->start_x, drag_info->start_y); |
| 491 } else { | 497 } else { |
| 492 if (OnMouseDragged(e)) | 498 if (OnMouseDragged(e)) |
| 493 return true; | 499 return true; |
| 494 // Fall through to return value based on context menu controller. | 500 // Fall through to return value based on context menu controller. |
| 495 } | 501 } |
| 496 // WARNING: we may have been deleted. | 502 // WARNING: we may have been deleted. |
| 497 return (context_menu_controller != NULL) || possible_drag; | 503 return (context_menu_controller != NULL) || possible_drag; |
| 498 } | 504 } |
| 499 | 505 |
| 500 void View::ProcessMouseReleased(const MouseEvent& e, bool canceled) { | 506 void View::ProcessMouseReleased(const MouseEvent& e, bool canceled) { |
| (...skipping 907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1408 start_x = start_y = 0; | 1414 start_x = start_y = 0; |
| 1409 } | 1415 } |
| 1410 | 1416 |
| 1411 void View::DragInfo::PossibleDrag(int x, int y) { | 1417 void View::DragInfo::PossibleDrag(int x, int y) { |
| 1412 possible_drag = true; | 1418 possible_drag = true; |
| 1413 start_x = x; | 1419 start_x = x; |
| 1414 start_y = y; | 1420 start_y = y; |
| 1415 } | 1421 } |
| 1416 | 1422 |
| 1417 } // namespace | 1423 } // namespace |
| OLD | NEW |