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/base_event_utils.h" | |
14 #include "ui/events/blink/blink_event_util.h" | 15 #include "ui/events/blink/blink_event_util.h" |
15 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" | 16 #include "ui/events/gesture_detection/gesture_provider_config_helper.h" |
16 #include "ui/gfx/image/image.h" | 17 #include "ui/gfx/image/image.h" |
17 #include "ui/gfx/screen.h" | 18 #include "ui/gfx/screen.h" |
18 | 19 |
19 using blink::WebGestureEvent; | 20 using blink::WebGestureEvent; |
20 using blink::WebInputEvent; | 21 using blink::WebInputEvent; |
21 using blink::WebKeyboardEvent; | 22 using blink::WebKeyboardEvent; |
22 using blink::WebMouseEvent; | 23 using blink::WebMouseEvent; |
23 using blink::WebMouseWheelEvent; | 24 using blink::WebMouseWheelEvent; |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 if (!native_stream_active_sequence_count_ && !is_sequence_start) | 219 if (!native_stream_active_sequence_count_ && !is_sequence_start) |
219 return true; | 220 return true; |
220 | 221 |
221 if (is_sequence_start) | 222 if (is_sequence_start) |
222 native_stream_active_sequence_count_++; | 223 native_stream_active_sequence_count_++; |
223 return false; | 224 return false; |
224 } | 225 } |
225 | 226 |
226 void TouchEmulator::HandleEmulatedTouchEvent(blink::WebTouchEvent event) { | 227 void TouchEmulator::HandleEmulatedTouchEvent(blink::WebTouchEvent event) { |
227 DCHECK(gesture_provider_); | 228 DCHECK(gesture_provider_); |
229 event.uniqueTouchEventId = ui::GetNextTouchEventId(); | |
sadrul
2015/04/23 16:56:23
Should this happen in WebTouchEventTraits::ResetTy
lanwei
2015/04/24 20:21:09
Tim pointed out that ResetTypeAndTouchStates may b
tdresser
2015/04/27 14:02:24
Currently we only call ResetTypeAndTouchStates onc
| |
228 auto result = gesture_provider_->OnTouchEvent(MotionEventWeb(event)); | 230 auto result = gesture_provider_->OnTouchEvent(MotionEventWeb(event)); |
229 if (!result.succeeded) | 231 if (!result.succeeded) |
230 return; | 232 return; |
231 | 233 |
232 const bool event_consumed = true; | 234 const bool event_consumed = true; |
233 // Block emulated event when emulated native stream is active. | 235 // Block emulated event when emulated native stream is active. |
234 if (native_stream_active_sequence_count_) { | 236 if (native_stream_active_sequence_count_) { |
235 gesture_provider_->OnSyncTouchEventAck(event_consumed); | 237 gesture_provider_->OnSyncTouchEventAck(event_consumed); |
236 return; | 238 return; |
237 } | 239 } |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
442 point.screenPosition.x = mouse_event.globalX; | 444 point.screenPosition.x = mouse_event.globalX; |
443 point.position.y = mouse_event.y; | 445 point.position.y = mouse_event.y; |
444 point.screenPosition.y = mouse_event.globalY; | 446 point.screenPosition.y = mouse_event.globalY; |
445 } | 447 } |
446 | 448 |
447 bool TouchEmulator::InPinchGestureMode() const { | 449 bool TouchEmulator::InPinchGestureMode() const { |
448 return shift_pressed_; | 450 return shift_pressed_; |
449 } | 451 } |
450 | 452 |
451 } // namespace content | 453 } // namespace content |
OLD | NEW |