| 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/public/common/content_client.h" | 10 #include "content/public/common/content_client.h" |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 DCHECK(pinch_gesture_active_); | 319 DCHECK(pinch_gesture_active_); |
| 320 pinch_gesture_active_ = false; | 320 pinch_gesture_active_ = false; |
| 321 FillPinchEvent(event); | 321 FillPinchEvent(event); |
| 322 pinch_event_.type = WebInputEvent::GesturePinchEnd; | 322 pinch_event_.type = WebInputEvent::GesturePinchEnd; |
| 323 client_->ForwardGestureEvent(pinch_event_); | 323 client_->ForwardGestureEvent(pinch_event_); |
| 324 } | 324 } |
| 325 | 325 |
| 326 void TouchEmulator::FillPinchEvent(const WebInputEvent& event) { | 326 void TouchEmulator::FillPinchEvent(const WebInputEvent& event) { |
| 327 pinch_event_.timeStampSeconds = event.timeStampSeconds; | 327 pinch_event_.timeStampSeconds = event.timeStampSeconds; |
| 328 pinch_event_.modifiers = event.modifiers; | 328 pinch_event_.modifiers = event.modifiers; |
| 329 pinch_event_.sourceDevice = blink::WebGestureEvent::Touchscreen; | 329 pinch_event_.sourceDevice = blink::WebGestureDeviceTouchscreen; |
| 330 pinch_event_.x = pinch_anchor_.x(); | 330 pinch_event_.x = pinch_anchor_.x(); |
| 331 pinch_event_.y = pinch_anchor_.y(); | 331 pinch_event_.y = pinch_anchor_.y(); |
| 332 } | 332 } |
| 333 | 333 |
| 334 void TouchEmulator::ScrollEnd(const WebGestureEvent& event) { | 334 void TouchEmulator::ScrollEnd(const WebGestureEvent& event) { |
| 335 WebGestureEvent scroll_event; | 335 WebGestureEvent scroll_event; |
| 336 scroll_event.timeStampSeconds = event.timeStampSeconds; | 336 scroll_event.timeStampSeconds = event.timeStampSeconds; |
| 337 scroll_event.modifiers = event.modifiers; | 337 scroll_event.modifiers = event.modifiers; |
| 338 scroll_event.sourceDevice = blink::WebGestureEvent::Touchscreen; | 338 scroll_event.sourceDevice = blink::WebGestureDeviceTouchscreen; |
| 339 scroll_event.type = WebInputEvent::GestureScrollEnd; | 339 scroll_event.type = WebInputEvent::GestureScrollEnd; |
| 340 client_->ForwardGestureEvent(scroll_event); | 340 client_->ForwardGestureEvent(scroll_event); |
| 341 } | 341 } |
| 342 | 342 |
| 343 bool TouchEmulator::FillTouchEventAndPoint(const WebMouseEvent& mouse_event) { | 343 bool TouchEmulator::FillTouchEventAndPoint(const WebMouseEvent& mouse_event) { |
| 344 if (mouse_event.type != WebInputEvent::MouseDown && | 344 if (mouse_event.type != WebInputEvent::MouseDown && |
| 345 mouse_event.type != WebInputEvent::MouseMove && | 345 mouse_event.type != WebInputEvent::MouseMove && |
| 346 mouse_event.type != WebInputEvent::MouseUp) { | 346 mouse_event.type != WebInputEvent::MouseUp) { |
| 347 return false; | 347 return false; |
| 348 } | 348 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 point.screenPosition.y = mouse_event.globalY; | 380 point.screenPosition.y = mouse_event.globalY; |
| 381 | 381 |
| 382 return true; | 382 return true; |
| 383 } | 383 } |
| 384 | 384 |
| 385 bool TouchEmulator::InPinchGestureMode() const { | 385 bool TouchEmulator::InPinchGestureMode() const { |
| 386 return shift_pressed_ && allow_pinch_; | 386 return shift_pressed_ && allow_pinch_; |
| 387 } | 387 } |
| 388 | 388 |
| 389 } // namespace content | 389 } // namespace content |
| OLD | NEW |