Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1121)

Side by Side Diff: content/browser/renderer_host/input/touch_emulator.cc

Issue 304793003: use enum to specify deviceSource for fling animation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed desired #include Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 DCHECK(pinch_gesture_active_); 312 DCHECK(pinch_gesture_active_);
313 pinch_gesture_active_ = false; 313 pinch_gesture_active_ = false;
314 FillPinchEvent(event); 314 FillPinchEvent(event);
315 pinch_event_.type = WebInputEvent::GesturePinchEnd; 315 pinch_event_.type = WebInputEvent::GesturePinchEnd;
316 client_->ForwardGestureEvent(pinch_event_); 316 client_->ForwardGestureEvent(pinch_event_);
317 } 317 }
318 318
319 void TouchEmulator::FillPinchEvent(const WebInputEvent& event) { 319 void TouchEmulator::FillPinchEvent(const WebInputEvent& event) {
320 pinch_event_.timeStampSeconds = event.timeStampSeconds; 320 pinch_event_.timeStampSeconds = event.timeStampSeconds;
321 pinch_event_.modifiers = event.modifiers; 321 pinch_event_.modifiers = event.modifiers;
322 pinch_event_.sourceDevice = blink::WebGestureEvent::Touchscreen; 322 pinch_event_.sourceDevice = blink::WebGestureDeviceTouchpad;
323 pinch_event_.x = pinch_anchor_.x(); 323 pinch_event_.x = pinch_anchor_.x();
324 pinch_event_.y = pinch_anchor_.y(); 324 pinch_event_.y = pinch_anchor_.y();
325 } 325 }
326 326
327 void TouchEmulator::ScrollEnd(const WebGestureEvent& event) { 327 void TouchEmulator::ScrollEnd(const WebGestureEvent& event) {
328 WebGestureEvent scroll_event; 328 WebGestureEvent scroll_event;
329 scroll_event.timeStampSeconds = event.timeStampSeconds; 329 scroll_event.timeStampSeconds = event.timeStampSeconds;
330 scroll_event.modifiers = event.modifiers; 330 scroll_event.modifiers = event.modifiers;
331 scroll_event.sourceDevice = blink::WebGestureEvent::Touchscreen; 331 scroll_event.sourceDevice = blink::WebGestureDeviceTouchpad;
332 scroll_event.type = WebInputEvent::GestureScrollEnd; 332 scroll_event.type = WebInputEvent::GestureScrollEnd;
333 client_->ForwardGestureEvent(scroll_event); 333 client_->ForwardGestureEvent(scroll_event);
334 } 334 }
335 335
336 bool TouchEmulator::FillTouchEventAndPoint(const WebMouseEvent& mouse_event) { 336 bool TouchEmulator::FillTouchEventAndPoint(const WebMouseEvent& mouse_event) {
337 if (mouse_event.type != WebInputEvent::MouseDown && 337 if (mouse_event.type != WebInputEvent::MouseDown &&
338 mouse_event.type != WebInputEvent::MouseMove && 338 mouse_event.type != WebInputEvent::MouseMove &&
339 mouse_event.type != WebInputEvent::MouseUp) { 339 mouse_event.type != WebInputEvent::MouseUp) {
340 return false; 340 return false;
341 } 341 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 point.screenPosition.y = mouse_event.globalY; 373 point.screenPosition.y = mouse_event.globalY;
374 374
375 return true; 375 return true;
376 } 376 }
377 377
378 bool TouchEmulator::InPinchGestureMode() const { 378 bool TouchEmulator::InPinchGestureMode() const {
379 return shift_pressed_ && allow_pinch_; 379 return shift_pressed_ && allow_pinch_;
380 } 380 }
381 381
382 } // namespace content 382 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698