| 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 1010 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 case ui::ET_MOUSE_RELEASED: | 1021 case ui::ET_MOUSE_RELEASED: |
| 1022 ProcessMouseReleased(*event); | 1022 ProcessMouseReleased(*event); |
| 1023 return; | 1023 return; |
| 1024 | 1024 |
| 1025 case ui::ET_MOUSEWHEEL: | 1025 case ui::ET_MOUSEWHEEL: |
| 1026 if (OnMouseWheel(*static_cast<ui::MouseWheelEvent*>(event))) | 1026 if (OnMouseWheel(*static_cast<ui::MouseWheelEvent*>(event))) |
| 1027 event->SetHandled(); | 1027 event->SetHandled(); |
| 1028 break; | 1028 break; |
| 1029 | 1029 |
| 1030 case ui::ET_MOUSE_ENTERED: | 1030 case ui::ET_MOUSE_ENTERED: |
| 1031 if (event->flags() & ui::EF_TOUCH_ACCESSIBILITY) | |
| 1032 NotifyAccessibilityEvent(ui::AX_EVENT_HOVER, true); | |
| 1033 OnMouseEntered(*event); | 1031 OnMouseEntered(*event); |
| 1034 break; | 1032 break; |
| 1035 | 1033 |
| 1036 case ui::ET_MOUSE_EXITED: | 1034 case ui::ET_MOUSE_EXITED: |
| 1037 OnMouseExited(*event); | 1035 OnMouseExited(*event); |
| 1038 break; | 1036 break; |
| 1039 | 1037 |
| 1040 default: | 1038 default: |
| 1041 return; | 1039 return; |
| 1042 } | 1040 } |
| 1043 } | 1041 } |
| 1044 | 1042 |
| 1045 void View::OnScrollEvent(ui::ScrollEvent* event) { | 1043 void View::OnScrollEvent(ui::ScrollEvent* event) { |
| 1046 } | 1044 } |
| 1047 | 1045 |
| 1048 void View::OnTouchEvent(ui::TouchEvent* event) { | 1046 void View::OnTouchEvent(ui::TouchEvent* event) { |
| 1049 NOTREACHED() << "Views should not receive touch events."; | 1047 NOTREACHED() << "Views should not receive touch events."; |
| 1050 } | 1048 } |
| 1051 | 1049 |
| 1052 void View::OnGestureEvent(ui::GestureEvent* event) { | 1050 void View::OnGestureEvent(ui::GestureEvent* event) { |
| 1053 } | 1051 } |
| 1054 | 1052 |
| 1053 void View::OnAccessibilityMouseEvent(ui::MouseEvent* event) { |
| 1054 switch (event->type()) { |
| 1055 case ui::ET_MOUSE_PRESSED: |
| 1056 NotifyAccessibilityEvent(ui::AX_EVENT_MOUSE_PRESSED, true); |
| 1057 break; |
| 1058 case ui::ET_MOUSE_DRAGGED: |
| 1059 NotifyAccessibilityEvent(ui::AX_EVENT_MOUSE_DRAGGED, true); |
| 1060 break; |
| 1061 case ui::ET_MOUSE_RELEASED: |
| 1062 NotifyAccessibilityEvent(ui::AX_EVENT_MOUSE_RELEASED, true); |
| 1063 break; |
| 1064 case ui::ET_MOUSE_MOVED: |
| 1065 NotifyAccessibilityEvent(ui::AX_EVENT_MOUSE_MOVED, true); |
| 1066 break; |
| 1067 case ui::ET_MOUSE_ENTERED: |
| 1068 NotifyAccessibilityEvent(ui::AX_EVENT_MOUSE_ENTERED, true); |
| 1069 break; |
| 1070 case ui::ET_MOUSE_EXITED: |
| 1071 NotifyAccessibilityEvent(ui::AX_EVENT_MOUSE_EXITED, true); |
| 1072 break; |
| 1073 default: |
| 1074 NOTREACHED(); |
| 1075 break; |
| 1076 } |
| 1077 } |
| 1078 |
| 1055 const ui::InputMethod* View::GetInputMethod() const { | 1079 const ui::InputMethod* View::GetInputMethod() const { |
| 1056 Widget* widget = const_cast<Widget*>(GetWidget()); | 1080 Widget* widget = const_cast<Widget*>(GetWidget()); |
| 1057 return widget ? const_cast<const ui::InputMethod*>(widget->GetInputMethod()) | 1081 return widget ? const_cast<const ui::InputMethod*>(widget->GetInputMethod()) |
| 1058 : nullptr; | 1082 : nullptr; |
| 1059 } | 1083 } |
| 1060 | 1084 |
| 1061 scoped_ptr<ViewTargeter> | 1085 scoped_ptr<ViewTargeter> |
| 1062 View::SetEventTargeter(scoped_ptr<ViewTargeter> targeter) { | 1086 View::SetEventTargeter(scoped_ptr<ViewTargeter> targeter) { |
| 1063 scoped_ptr<ViewTargeter> old_targeter = std::move(targeter_); | 1087 scoped_ptr<ViewTargeter> old_targeter = std::move(targeter_); |
| 1064 targeter_ = std::move(targeter); | 1088 targeter_ = std::move(targeter); |
| (...skipping 1323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2388 // Message the RootView to do the drag and drop. That way if we're removed | 2412 // Message the RootView to do the drag and drop. That way if we're removed |
| 2389 // the RootView can detect it and avoid calling us back. | 2413 // the RootView can detect it and avoid calling us back. |
| 2390 gfx::Point widget_location(event.location()); | 2414 gfx::Point widget_location(event.location()); |
| 2391 ConvertPointToWidget(this, &widget_location); | 2415 ConvertPointToWidget(this, &widget_location); |
| 2392 widget->RunShellDrag(this, data, widget_location, drag_operations, source); | 2416 widget->RunShellDrag(this, data, widget_location, drag_operations, source); |
| 2393 // WARNING: we may have been deleted. | 2417 // WARNING: we may have been deleted. |
| 2394 return true; | 2418 return true; |
| 2395 } | 2419 } |
| 2396 | 2420 |
| 2397 } // namespace views | 2421 } // namespace views |
| OLD | NEW |