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 "chrome/views/view.h" | 5 #include "chrome/views/view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #ifndef NDEBUG | 9 #ifndef NDEBUG |
10 #include <iostream> | 10 #include <iostream> |
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 // | 455 // |
456 ///////////////////////////////////////////////////////////////////////////// | 456 ///////////////////////////////////////////////////////////////////////////// |
457 | 457 |
458 bool View::ProcessMousePressed(const MouseEvent& e, DragInfo* drag_info) { | 458 bool View::ProcessMousePressed(const MouseEvent& e, DragInfo* drag_info) { |
459 const bool enabled = enabled_; | 459 const bool enabled = enabled_; |
460 int drag_operations; | 460 int drag_operations; |
461 if (enabled && e.IsOnlyLeftMouseButton() && HitTest(e.location())) | 461 if (enabled && e.IsOnlyLeftMouseButton() && HitTest(e.location())) |
462 drag_operations = GetDragOperations(e.x(), e.y()); | 462 drag_operations = GetDragOperations(e.x(), e.y()); |
463 else | 463 else |
464 drag_operations = 0; | 464 drag_operations = 0; |
465 ContextMenuController* context_menu_controller = context_menu_controller_; | 465 ContextMenuController* context_menu_controller = |
| 466 e.IsRightMouseButton() ? context_menu_controller_ : 0; |
466 | 467 |
467 const bool result = OnMousePressed(e); | 468 const bool result = OnMousePressed(e); |
468 // WARNING: we may have been deleted, don't use any View variables; | 469 // WARNING: we may have been deleted, don't use any View variables; |
469 | 470 |
470 if (!enabled) | 471 if (!enabled) |
471 return result; | 472 return result; |
472 | 473 |
473 if (drag_operations != DragDropTypes::DRAG_NONE) { | 474 if (drag_operations != DragDropTypes::DRAG_NONE) { |
474 drag_info->PossibleDrag(e.x(), e.y()); | 475 drag_info->PossibleDrag(e.x(), e.y()); |
475 return true; | 476 return true; |
(...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1628 start_x = start_y = 0; | 1629 start_x = start_y = 0; |
1629 } | 1630 } |
1630 | 1631 |
1631 void View::DragInfo::PossibleDrag(int x, int y) { | 1632 void View::DragInfo::PossibleDrag(int x, int y) { |
1632 possible_drag = true; | 1633 possible_drag = true; |
1633 start_x = x; | 1634 start_x = x; |
1634 start_y = y; | 1635 start_y = y; |
1635 } | 1636 } |
1636 | 1637 |
1637 } // namespace | 1638 } // namespace |
OLD | NEW |