| 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/public/common/content_client.h" | 9 #include "content/public/common/content_client.h" |
| 10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 void TouchEmulator::CancelTouch() { | 250 void TouchEmulator::CancelTouch() { |
| 251 if (!touch_active_) | 251 if (!touch_active_) |
| 252 return; | 252 return; |
| 253 | 253 |
| 254 touch_event_.timeStampSeconds = | 254 touch_event_.timeStampSeconds = |
| 255 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); | 255 (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); |
| 256 touch_event_.type = WebInputEvent::TouchCancel; | 256 touch_event_.type = WebInputEvent::TouchCancel; |
| 257 touch_event_.cancelable = false; |
| 257 touch_event_.touches[0].state = WebTouchPoint::StateCancelled; | 258 touch_event_.touches[0].state = WebTouchPoint::StateCancelled; |
| 258 touch_active_ = false; | 259 touch_active_ = false; |
| 259 if (gesture_provider_.OnTouchEvent(MotionEventWeb(touch_event_))) | 260 if (gesture_provider_.OnTouchEvent(MotionEventWeb(touch_event_))) |
| 260 client_->ForwardTouchEvent(touch_event_); | 261 client_->ForwardTouchEvent(touch_event_); |
| 261 } | 262 } |
| 262 | 263 |
| 263 void TouchEmulator::UpdateCursor() { | 264 void TouchEmulator::UpdateCursor() { |
| 264 if (!enabled_) | 265 if (!enabled_) |
| 265 client_->SetCursor(pointer_cursor_); | 266 client_->SetCursor(pointer_cursor_); |
| 266 else | 267 else |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 NOTREACHED(); | 363 NOTREACHED(); |
| 363 } | 364 } |
| 364 return true; | 365 return true; |
| 365 } | 366 } |
| 366 | 367 |
| 367 bool TouchEmulator::InPinchGestureMode() const { | 368 bool TouchEmulator::InPinchGestureMode() const { |
| 368 return shift_pressed_ && allow_pinch_; | 369 return shift_pressed_ && allow_pinch_; |
| 369 } | 370 } |
| 370 | 371 |
| 371 } // namespace content | 372 } // namespace content |
| OLD | NEW |