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" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 suppress_next_fling_cancel_ = false; | 324 suppress_next_fling_cancel_ = false; |
325 break; | 325 break; |
326 | 326 |
327 default: | 327 default: |
328 // Everything else goes through. | 328 // Everything else goes through. |
329 client_->ForwardGestureEvent(gesture_event); | 329 client_->ForwardGestureEvent(gesture_event); |
330 } | 330 } |
331 } | 331 } |
332 | 332 |
333 void TouchEmulator::CancelTouch() { | 333 void TouchEmulator::CancelTouch() { |
334 if (!emulated_stream_active_sequence_count_) | 334 if (!emulated_stream_active_sequence_count_ || !enabled()) |
335 return; | 335 return; |
336 | 336 |
337 WebTouchEventTraits::ResetTypeAndTouchStates( | 337 WebTouchEventTraits::ResetTypeAndTouchStates( |
338 WebInputEvent::TouchCancel, | 338 WebInputEvent::TouchCancel, |
339 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(), | 339 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(), |
340 &touch_event_); | 340 &touch_event_); |
341 DCHECK(gesture_provider_); | 341 DCHECK(gesture_provider_); |
342 if (gesture_provider_->GetCurrentDownEvent()) | 342 if (gesture_provider_->GetCurrentDownEvent()) |
343 HandleEmulatedTouchEvent(touch_event_); | 343 HandleEmulatedTouchEvent(touch_event_); |
344 } | 344 } |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 point.screenPosition.x = mouse_event.globalX; | 436 point.screenPosition.x = mouse_event.globalX; |
437 point.position.y = mouse_event.y; | 437 point.position.y = mouse_event.y; |
438 point.screenPosition.y = mouse_event.globalY; | 438 point.screenPosition.y = mouse_event.globalY; |
439 } | 439 } |
440 | 440 |
441 bool TouchEmulator::InPinchGestureMode() const { | 441 bool TouchEmulator::InPinchGestureMode() const { |
442 return shift_pressed_; | 442 return shift_pressed_; |
443 } | 443 } |
444 | 444 |
445 } // namespace content | 445 } // namespace content |
OLD | NEW |