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/events/event.h" | 10 #include "ui/base/events/event.h" |
(...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1157 return static_cast<internal::RootView*>(GetRootView())-> | 1157 return static_cast<internal::RootView*>(GetRootView())-> |
1158 DispatchTouchEvent(event); | 1158 DispatchTouchEvent(event); |
1159 } | 1159 } |
1160 | 1160 |
1161 ui::EventResult Widget::OnScrollEvent(ui::ScrollEvent* event) { | 1161 ui::EventResult Widget::OnScrollEvent(ui::ScrollEvent* event) { |
1162 ScopedEvent scoped(this, *event); | 1162 ScopedEvent scoped(this, *event); |
1163 return static_cast<internal::RootView*>(GetRootView())-> | 1163 return static_cast<internal::RootView*>(GetRootView())-> |
1164 DispatchScrollEvent(event); | 1164 DispatchScrollEvent(event); |
1165 } | 1165 } |
1166 | 1166 |
1167 ui::EventResult Widget::OnGestureEvent(ui::GestureEvent* event) { | 1167 void Widget::OnGestureEvent(ui::GestureEvent* event) { |
1168 ScopedEvent scoped(this, *event); | 1168 ScopedEvent scoped(this, *event); |
1169 switch (event->type()) { | 1169 switch (event->type()) { |
1170 case ui::ET_GESTURE_TAP_DOWN: | 1170 case ui::ET_GESTURE_TAP_DOWN: |
1171 is_touch_down_ = true; | 1171 is_touch_down_ = true; |
1172 // We explicitly don't capture here. Not capturing enables multiple | 1172 // We explicitly don't capture here. Not capturing enables multiple |
1173 // widgets to get tap events at the same time. Views (such as tab | 1173 // widgets to get tap events at the same time. Views (such as tab |
1174 // dragging) may explicitly capture. | 1174 // dragging) may explicitly capture. |
1175 break; | 1175 break; |
1176 | 1176 |
1177 case ui::ET_GESTURE_END: | 1177 case ui::ET_GESTURE_END: |
1178 if (event->details().touch_points() == 1) { | 1178 if (event->details().touch_points() == 1) { |
1179 is_touch_down_ = false; | 1179 is_touch_down_ = false; |
1180 if (ShouldReleaseCaptureOnMouseReleased()) | 1180 if (ShouldReleaseCaptureOnMouseReleased()) |
1181 ReleaseCapture(); | 1181 ReleaseCapture(); |
1182 } | 1182 } |
1183 break; | 1183 break; |
1184 | 1184 |
1185 default: | 1185 default: |
1186 break; | 1186 break; |
1187 } | 1187 } |
1188 return static_cast<internal::RootView*>(GetRootView())-> | 1188 static_cast<internal::RootView*>(GetRootView())->DispatchGestureEvent(event); |
1189 DispatchGestureEvent(event); | |
1190 } | 1189 } |
1191 | 1190 |
1192 bool Widget::ExecuteCommand(int command_id) { | 1191 bool Widget::ExecuteCommand(int command_id) { |
1193 return widget_delegate_->ExecuteWindowsCommand(command_id); | 1192 return widget_delegate_->ExecuteWindowsCommand(command_id); |
1194 } | 1193 } |
1195 | 1194 |
1196 InputMethod* Widget::GetInputMethodDirect() { | 1195 InputMethod* Widget::GetInputMethodDirect() { |
1197 return input_method_.get(); | 1196 return input_method_.get(); |
1198 } | 1197 } |
1199 | 1198 |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1366 | 1365 |
1367 //////////////////////////////////////////////////////////////////////////////// | 1366 //////////////////////////////////////////////////////////////////////////////// |
1368 // internal::NativeWidgetPrivate, NativeWidget implementation: | 1367 // internal::NativeWidgetPrivate, NativeWidget implementation: |
1369 | 1368 |
1370 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { | 1369 internal::NativeWidgetPrivate* NativeWidgetPrivate::AsNativeWidgetPrivate() { |
1371 return this; | 1370 return this; |
1372 } | 1371 } |
1373 | 1372 |
1374 } // namespace internal | 1373 } // namespace internal |
1375 } // namespace views | 1374 } // namespace views |
OLD | NEW |