OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/renderer_host/input/touch_emulator.h" | 5 #include "content/browser/renderer_host/input/touch_emulator.h" |
6 | 6 |
7 #include "content/browser/renderer_host/input/motion_event_web.h" | 7 #include "content/browser/renderer_host/input/motion_event_web.h" |
8 #include "content/browser/renderer_host/input/web_input_event_util.h" | 8 #include "content/browser/renderer_host/input/web_input_event_util.h" |
9 #include "content/common/input/web_touch_event_traits.h" | 9 #include "content/common/input/web_touch_event_traits.h" |
10 #include "content/grit/content_resources.h" | 10 #include "content/grit/content_resources.h" |
11 #include "content/public/common/content_client.h" | 11 #include "content/public/common/content_client.h" |
12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
13 #include "third_party/WebKit/public/platform/WebCursorInfo.h" | 13 #include "third_party/WebKit/public/platform/WebCursorInfo.h" |
| 14 #include "ui/events/blink/blink_event_util.h" |
14 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" | 15 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" |
15 #include "ui/gfx/image/image.h" | 16 #include "ui/gfx/image/image.h" |
16 #include "ui/gfx/screen.h" | 17 #include "ui/gfx/screen.h" |
17 | 18 |
18 using blink::WebGestureEvent; | 19 using blink::WebGestureEvent; |
19 using blink::WebInputEvent; | 20 using blink::WebInputEvent; |
20 using blink::WebKeyboardEvent; | 21 using blink::WebKeyboardEvent; |
21 using blink::WebMouseEvent; | 22 using blink::WebMouseEvent; |
22 using blink::WebMouseWheelEvent; | 23 using blink::WebMouseWheelEvent; |
23 using blink::WebTouchEvent; | 24 using blink::WebTouchEvent; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 265 |
265 // We may have not seen native touch sequence start (when created in the | 266 // We may have not seen native touch sequence start (when created in the |
266 // middle of a sequence), so don't decrement sequence count below zero. | 267 // middle of a sequence), so don't decrement sequence count below zero. |
267 if (is_sequence_end && native_stream_active_sequence_count_) | 268 if (is_sequence_end && native_stream_active_sequence_count_) |
268 native_stream_active_sequence_count_--; | 269 native_stream_active_sequence_count_--; |
269 return false; | 270 return false; |
270 } | 271 } |
271 | 272 |
272 void TouchEmulator::OnGestureEvent(const ui::GestureEventData& gesture) { | 273 void TouchEmulator::OnGestureEvent(const ui::GestureEventData& gesture) { |
273 WebGestureEvent gesture_event = | 274 WebGestureEvent gesture_event = |
274 CreateWebGestureEventFromGestureEventData(gesture); | 275 ui::CreateWebGestureEventFromGestureEventData(gesture); |
275 | 276 |
276 switch (gesture_event.type) { | 277 switch (gesture_event.type) { |
277 case WebInputEvent::Undefined: | 278 case WebInputEvent::Undefined: |
278 NOTREACHED() << "Undefined WebInputEvent type"; | 279 NOTREACHED() << "Undefined WebInputEvent type"; |
279 // Bail without sending the junk event to the client. | 280 // Bail without sending the junk event to the client. |
280 return; | 281 return; |
281 | 282 |
282 case WebInputEvent::GestureScrollBegin: | 283 case WebInputEvent::GestureScrollBegin: |
283 client_->ForwardGestureEvent(gesture_event); | 284 client_->ForwardGestureEvent(gesture_event); |
284 // PinchBegin must always follow ScrollBegin. | 285 // PinchBegin must always follow ScrollBegin. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 point.screenPosition.x = mouse_event.globalX; | 442 point.screenPosition.x = mouse_event.globalX; |
442 point.position.y = mouse_event.y; | 443 point.position.y = mouse_event.y; |
443 point.screenPosition.y = mouse_event.globalY; | 444 point.screenPosition.y = mouse_event.globalY; |
444 } | 445 } |
445 | 446 |
446 bool TouchEmulator::InPinchGestureMode() const { | 447 bool TouchEmulator::InPinchGestureMode() const { |
447 return shift_pressed_; | 448 return shift_pressed_; |
448 } | 449 } |
449 | 450 |
450 } // namespace content | 451 } // namespace content |
OLD | NEW |