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/widget/widget.h" | 5 #include "ui/views/widget/widget.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "ui/base/event.h" | 10 #include "ui/base/event.h" |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 last_mouse_event_was_move_ = true; | 1098 last_mouse_event_was_move_ = true; |
1099 GetRootView()->OnMouseMoved(event); | 1099 GetRootView()->OnMouseMoved(event); |
1100 } | 1100 } |
1101 return false; | 1101 return false; |
1102 case ui::ET_MOUSE_EXITED: | 1102 case ui::ET_MOUSE_EXITED: |
1103 last_mouse_event_was_move_ = false; | 1103 last_mouse_event_was_move_ = false; |
1104 GetRootView()->OnMouseExited(event); | 1104 GetRootView()->OnMouseExited(event); |
1105 return false; | 1105 return false; |
1106 case ui::ET_MOUSEWHEEL: | 1106 case ui::ET_MOUSEWHEEL: |
1107 return GetRootView()->OnMouseWheel( | 1107 return GetRootView()->OnMouseWheel( |
1108 reinterpret_cast<const MouseWheelEvent&>(event)); | 1108 reinterpret_cast<const ui::MouseWheelEvent&>(event)); |
1109 case ui::ET_SCROLL: | 1109 case ui::ET_SCROLL: |
1110 return GetRootView()->OnScrollEvent( | 1110 return GetRootView()->OnScrollEvent( |
1111 reinterpret_cast<const ScrollEvent&>(event)); | 1111 reinterpret_cast<const ui::ScrollEvent&>(event)); |
1112 default: | 1112 default: |
1113 return false; | 1113 return false; |
1114 } | 1114 } |
1115 return true; | 1115 return true; |
1116 } | 1116 } |
1117 | 1117 |
1118 void Widget::OnMouseCaptureLost() { | 1118 void Widget::OnMouseCaptureLost() { |
1119 if (is_mouse_button_pressed_ || is_touch_down_) | 1119 if (is_mouse_button_pressed_ || is_touch_down_) |
1120 GetRootView()->OnMouseCaptureLost(); | 1120 GetRootView()->OnMouseCaptureLost(); |
1121 is_touch_down_ = false; | 1121 is_touch_down_ = false; |
1122 is_mouse_button_pressed_ = false; | 1122 is_mouse_button_pressed_ = false; |
1123 } | 1123 } |
1124 | 1124 |
1125 ui::TouchStatus Widget::OnTouchEvent(const TouchEvent& event) { | 1125 ui::TouchStatus Widget::OnTouchEvent(const ui::TouchEvent& event) { |
1126 ScopedEvent scoped(this, event); | 1126 ScopedEvent scoped(this, event); |
1127 return GetRootView()->OnTouchEvent(event); | 1127 return GetRootView()->OnTouchEvent(event); |
1128 } | 1128 } |
1129 | 1129 |
1130 ui::GestureStatus Widget::OnGestureEvent(const GestureEvent& event) { | 1130 ui::GestureStatus Widget::OnGestureEvent(const ui::GestureEvent& event) { |
1131 ScopedEvent scoped(this, event); | 1131 ScopedEvent scoped(this, event); |
1132 switch (event.type()) { | 1132 switch (event.type()) { |
1133 case ui::ET_GESTURE_TAP_DOWN: | 1133 case ui::ET_GESTURE_TAP_DOWN: |
1134 is_touch_down_ = true; | 1134 is_touch_down_ = true; |
1135 // We explicitly don't capture here. Not capturing enables multiple | 1135 // We explicitly don't capture here. Not capturing enables multiple |
1136 // widgets to get tap events at the same time. Views (such as tab | 1136 // widgets to get tap events at the same time. Views (such as tab |
1137 // dragging) may explicitly capture. | 1137 // dragging) may explicitly capture. |
1138 break; | 1138 break; |
1139 | 1139 |
1140 case ui::ET_GESTURE_END: | 1140 case ui::ET_GESTURE_END: |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 | 1328 |
1329 //////////////////////////////////////////////////////////////////////////////// | 1329 //////////////////////////////////////////////////////////////////////////////// |
1330 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1330 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1331 | 1331 |
1332 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1332 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1333 return this; | 1333 return this; |
1334 } | 1334 } |
1335 | 1335 |
1336 } // namespace internal | 1336 } // namespace internal |
1337 } // namespace views | 1337 } // namespace views |
OLD | NEW |