OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 } | 794 } |
795 | 795 |
796 bool View::OnMousePressed(const MouseEvent& event) { | 796 bool View::OnMousePressed(const MouseEvent& event) { |
797 return false; | 797 return false; |
798 } | 798 } |
799 | 799 |
800 bool View::OnMouseDragged(const MouseEvent& event) { | 800 bool View::OnMouseDragged(const MouseEvent& event) { |
801 return false; | 801 return false; |
802 } | 802 } |
803 | 803 |
804 void View::OnMouseReleased(const MouseEvent& event, bool canceled) { | 804 void View::OnMouseReleased(const MouseEvent& event) { |
| 805 } |
| 806 |
| 807 void View::OnMouseCaptureLost() { |
805 } | 808 } |
806 | 809 |
807 void View::OnMouseMoved(const MouseEvent& event) { | 810 void View::OnMouseMoved(const MouseEvent& event) { |
808 } | 811 } |
809 | 812 |
810 void View::OnMouseEntered(const MouseEvent& event) { | 813 void View::OnMouseEntered(const MouseEvent& event) { |
811 } | 814 } |
812 | 815 |
813 void View::OnMouseExited(const MouseEvent& event) { | 816 void View::OnMouseExited(const MouseEvent& event) { |
814 } | 817 } |
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1550 DoDrag(event, drag_info->start_pt); | 1553 DoDrag(event, drag_info->start_pt); |
1551 } else { | 1554 } else { |
1552 if (OnMouseDragged(event)) | 1555 if (OnMouseDragged(event)) |
1553 return true; | 1556 return true; |
1554 // Fall through to return value based on context menu controller. | 1557 // Fall through to return value based on context menu controller. |
1555 } | 1558 } |
1556 // WARNING: we may have been deleted. | 1559 // WARNING: we may have been deleted. |
1557 return (context_menu_controller != NULL) || possible_drag; | 1560 return (context_menu_controller != NULL) || possible_drag; |
1558 } | 1561 } |
1559 | 1562 |
1560 void View::ProcessMouseReleased(const MouseEvent& event, bool canceled) { | 1563 void View::ProcessMouseReleased(const MouseEvent& event) { |
1561 if (!canceled && context_menu_controller_ && event.IsOnlyRightMouseButton()) { | 1564 if (context_menu_controller_ && event.IsOnlyRightMouseButton()) { |
1562 // Assume that if there is a context menu controller we won't be deleted | 1565 // Assume that if there is a context menu controller we won't be deleted |
1563 // from mouse released. | 1566 // from mouse released. |
1564 gfx::Point location(event.location()); | 1567 gfx::Point location(event.location()); |
1565 OnMouseReleased(event, canceled); | 1568 OnMouseReleased(event); |
1566 if (HitTest(location)) { | 1569 if (HitTest(location)) { |
1567 ConvertPointToScreen(this, &location); | 1570 ConvertPointToScreen(this, &location); |
1568 ShowContextMenu(location, true); | 1571 ShowContextMenu(location, true); |
1569 } | 1572 } |
1570 } else { | 1573 } else { |
1571 OnMouseReleased(event, canceled); | 1574 OnMouseReleased(event); |
1572 } | 1575 } |
1573 // WARNING: we may have been deleted. | 1576 // WARNING: we may have been deleted. |
1574 } | 1577 } |
1575 | 1578 |
1576 #if defined(TOUCH_UI) | 1579 #if defined(TOUCH_UI) |
1577 View::TouchStatus View::ProcessTouchEvent(const TouchEvent& event) { | 1580 View::TouchStatus View::ProcessTouchEvent(const TouchEvent& event) { |
1578 // TODO(rjkroege): Implement a grab scheme similar to as | 1581 // TODO(rjkroege): Implement a grab scheme similar to as |
1579 // as is found in MousePressed. | 1582 // as is found in MousePressed. |
1580 return OnTouchEvent(event); | 1583 return OnTouchEvent(event); |
1581 } | 1584 } |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1719 | 1722 |
1720 OSExchangeData data; | 1723 OSExchangeData data; |
1721 WriteDragData(press_pt, &data); | 1724 WriteDragData(press_pt, &data); |
1722 | 1725 |
1723 // Message the RootView to do the drag and drop. That way if we're removed | 1726 // Message the RootView to do the drag and drop. That way if we're removed |
1724 // the RootView can detect it and avoid calling us back. | 1727 // the RootView can detect it and avoid calling us back. |
1725 GetWidget()->RunShellDrag(this, data, drag_operations); | 1728 GetWidget()->RunShellDrag(this, data, drag_operations); |
1726 } | 1729 } |
1727 | 1730 |
1728 } // namespace views | 1731 } // namespace views |
OLD | NEW |