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 "ui/views/view.h" | 5 #include "ui/views/view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
818 | 818 |
819 void View::OnMouseMoved(const ui::MouseEvent& event) { | 819 void View::OnMouseMoved(const ui::MouseEvent& event) { |
820 } | 820 } |
821 | 821 |
822 void View::OnMouseEntered(const ui::MouseEvent& event) { | 822 void View::OnMouseEntered(const ui::MouseEvent& event) { |
823 } | 823 } |
824 | 824 |
825 void View::OnMouseExited(const ui::MouseEvent& event) { | 825 void View::OnMouseExited(const ui::MouseEvent& event) { |
826 } | 826 } |
827 | 827 |
828 ui::TouchStatus View::OnTouchEvent(const TouchEvent& event) { | 828 ui::TouchStatus View::OnTouchEvent(const ui::TouchEvent& event) { |
829 return ui::TOUCH_STATUS_UNKNOWN; | 829 return ui::TOUCH_STATUS_UNKNOWN; |
830 } | 830 } |
831 | 831 |
832 ui::GestureStatus View::OnGestureEvent(const GestureEvent& event) { | 832 ui::GestureStatus View::OnGestureEvent(const ui::GestureEvent& event) { |
833 return ui::GESTURE_STATUS_UNKNOWN; | 833 return ui::GESTURE_STATUS_UNKNOWN; |
834 } | 834 } |
835 | 835 |
836 void View::SetMouseHandler(View* new_mouse_handler) { | 836 void View::SetMouseHandler(View* new_mouse_handler) { |
837 // |new_mouse_handler| may be NULL. | 837 // |new_mouse_handler| may be NULL. |
838 if (parent_) | 838 if (parent_) |
839 parent_->SetMouseHandler(new_mouse_handler); | 839 parent_->SetMouseHandler(new_mouse_handler); |
840 } | 840 } |
841 | 841 |
842 bool View::OnKeyPressed(const ui::KeyEvent& event) { | 842 bool View::OnKeyPressed(const ui::KeyEvent& event) { |
843 return false; | 843 return false; |
844 } | 844 } |
845 | 845 |
846 bool View::OnKeyReleased(const ui::KeyEvent& event) { | 846 bool View::OnKeyReleased(const ui::KeyEvent& event) { |
847 return false; | 847 return false; |
848 } | 848 } |
849 | 849 |
850 bool View::OnMouseWheel(const MouseWheelEvent& event) { | 850 bool View::OnMouseWheel(const ui::MouseWheelEvent& event) { |
851 return false; | 851 return false; |
852 } | 852 } |
853 | 853 |
854 bool View::OnScrollEvent(const ScrollEvent& event) { | 854 bool View::OnScrollEvent(const ui::ScrollEvent& event) { |
855 return false; | 855 return false; |
856 } | 856 } |
857 | 857 |
858 ui::TextInputClient* View::GetTextInputClient() { | 858 ui::TextInputClient* View::GetTextInputClient() { |
859 return NULL; | 859 return NULL; |
860 } | 860 } |
861 | 861 |
862 InputMethod* View::GetInputMethod() { | 862 InputMethod* View::GetInputMethod() { |
863 Widget* widget = GetWidget(); | 863 Widget* widget = GetWidget(); |
864 return widget ? widget->GetInputMethod() : NULL; | 864 return widget ? widget->GetInputMethod() : NULL; |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1007 | 1007 |
1008 bool View::AreDropTypesRequired() { | 1008 bool View::AreDropTypesRequired() { |
1009 return false; | 1009 return false; |
1010 } | 1010 } |
1011 | 1011 |
1012 bool View::CanDrop(const OSExchangeData& data) { | 1012 bool View::CanDrop(const OSExchangeData& data) { |
1013 // TODO(sky): when I finish up migration, this should default to true. | 1013 // TODO(sky): when I finish up migration, this should default to true. |
1014 return false; | 1014 return false; |
1015 } | 1015 } |
1016 | 1016 |
1017 void View::OnDragEntered(const DropTargetEvent& event) { | 1017 void View::OnDragEntered(const ui::DropTargetEvent& event) { |
1018 } | 1018 } |
1019 | 1019 |
1020 int View::OnDragUpdated(const DropTargetEvent& event) { | 1020 int View::OnDragUpdated(const ui::DropTargetEvent& event) { |
1021 return ui::DragDropTypes::DRAG_NONE; | 1021 return ui::DragDropTypes::DRAG_NONE; |
1022 } | 1022 } |
1023 | 1023 |
1024 void View::OnDragExited() { | 1024 void View::OnDragExited() { |
1025 } | 1025 } |
1026 | 1026 |
1027 int View::OnPerformDrop(const DropTargetEvent& event) { | 1027 int View::OnPerformDrop(const ui::DropTargetEvent& event) { |
1028 return ui::DragDropTypes::DRAG_NONE; | 1028 return ui::DragDropTypes::DRAG_NONE; |
1029 } | 1029 } |
1030 | 1030 |
1031 void View::OnDragDone() { | 1031 void View::OnDragDone() { |
1032 } | 1032 } |
1033 | 1033 |
1034 // static | 1034 // static |
1035 bool View::ExceededDragThreshold(int delta_x, int delta_y) { | 1035 bool View::ExceededDragThreshold(int delta_x, int delta_y) { |
1036 return (abs(delta_x) > GetHorizontalDragThreshold() || | 1036 return (abs(delta_x) > GetHorizontalDragThreshold() || |
1037 abs(delta_y) > GetVerticalDragThreshold()); | 1037 abs(delta_y) > GetVerticalDragThreshold()); |
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1952 if (HitTestPoint(location)) { | 1952 if (HitTestPoint(location)) { |
1953 ConvertPointToScreen(this, &location); | 1953 ConvertPointToScreen(this, &location); |
1954 ShowContextMenu(location, true); | 1954 ShowContextMenu(location, true); |
1955 } | 1955 } |
1956 } else { | 1956 } else { |
1957 OnMouseReleased(event); | 1957 OnMouseReleased(event); |
1958 } | 1958 } |
1959 // WARNING: we may have been deleted. | 1959 // WARNING: we may have been deleted. |
1960 } | 1960 } |
1961 | 1961 |
1962 ui::TouchStatus View::ProcessTouchEvent(const TouchEvent& event) { | 1962 ui::TouchStatus View::ProcessTouchEvent(const ui::TouchEvent& event) { |
1963 // TODO(rjkroege): Implement a grab scheme similar to as as is found in | 1963 // TODO(rjkroege): Implement a grab scheme similar to as as is found in |
1964 // MousePressed. | 1964 // MousePressed. |
1965 return OnTouchEvent(event); | 1965 return OnTouchEvent(event); |
1966 } | 1966 } |
1967 | 1967 |
1968 ui::GestureStatus View::ProcessGestureEvent(const GestureEvent& event) { | 1968 ui::GestureStatus View::ProcessGestureEvent(const ui::GestureEvent& event) { |
1969 if (context_menu_controller_ && | 1969 if (context_menu_controller_ && |
1970 (event.type() == ui::ET_GESTURE_LONG_PRESS || | 1970 (event.type() == ui::ET_GESTURE_LONG_PRESS || |
1971 event.type() == ui::ET_GESTURE_TWO_FINGER_TAP)) { | 1971 event.type() == ui::ET_GESTURE_TWO_FINGER_TAP)) { |
1972 gfx::Point location(event.location()); | 1972 gfx::Point location(event.location()); |
1973 ConvertPointToScreen(this, &location); | 1973 ConvertPointToScreen(this, &location); |
1974 ShowContextMenu(location, true); | 1974 ShowContextMenu(location, true); |
1975 return ui::GESTURE_STATUS_CONSUMED; | 1975 return ui::GESTURE_STATUS_CONSUMED; |
1976 } | 1976 } |
1977 return OnGestureEvent(event); | 1977 return OnGestureEvent(event); |
1978 } | 1978 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2113 gfx::Point widget_location(event.location()); | 2113 gfx::Point widget_location(event.location()); |
2114 ConvertPointToWidget(this, &widget_location); | 2114 ConvertPointToWidget(this, &widget_location); |
2115 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations); | 2115 GetWidget()->RunShellDrag(this, data, widget_location, drag_operations); |
2116 return true; | 2116 return true; |
2117 #else | 2117 #else |
2118 return false; | 2118 return false; |
2119 #endif // !defined(OS_MACOSX) | 2119 #endif // !defined(OS_MACOSX) |
2120 } | 2120 } |
2121 | 2121 |
2122 } // namespace views | 2122 } // namespace views |
OLD | NEW |