OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "webkit/child/webkitplatformsupport_child_impl.h" | 5 #include "webkit/child/webkitplatformsupport_child_impl.h" |
6 | 6 |
| 7 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
| 8 #include "webkit/child/fling_curve_configuration.h" |
| 9 |
| 10 #if defined(OS_ANDROID) |
| 11 #include "webkit/child/fling_animator_impl_android.h" |
| 12 #endif |
| 13 |
7 namespace webkit_glue { | 14 namespace webkit_glue { |
8 | 15 |
9 WebKitPlatformSupportChildImpl::WebKitPlatformSupportChildImpl() { | 16 WebKitPlatformSupportChildImpl::WebKitPlatformSupportChildImpl() |
| 17 : fling_curve_configuration_(new FlingCurveConfiguration) {} |
| 18 |
| 19 WebKitPlatformSupportChildImpl::~WebKitPlatformSupportChildImpl() {} |
| 20 |
| 21 void WebKitPlatformSupportChildImpl::SetFlingCurveParameters( |
| 22 const std::vector<float>& new_touchpad, |
| 23 const std::vector<float>& new_touchscreen) { |
| 24 fling_curve_configuration_->SetCurveParameters(new_touchpad, new_touchscreen); |
10 } | 25 } |
11 | 26 |
12 WebKitPlatformSupportChildImpl::~WebKitPlatformSupportChildImpl() { | 27 WebKit::WebGestureCurve* |
| 28 WebKitPlatformSupportChildImpl::createFlingAnimationCurve( |
| 29 int device_source, |
| 30 const WebKit::WebFloatPoint& velocity, |
| 31 const WebKit::WebSize& cumulative_scroll) { |
| 32 #if defined(OS_ANDROID) |
| 33 return FlingAnimatorImpl::CreateAndroidGestureCurve(velocity, |
| 34 cumulative_scroll); |
| 35 #endif |
| 36 |
| 37 if (device_source == WebKit::WebGestureEvent::Touchscreen) |
| 38 return fling_curve_configuration_->CreateForTouchScreen(velocity, |
| 39 cumulative_scroll); |
| 40 |
| 41 return fling_curve_configuration_->CreateForTouchPad(velocity, |
| 42 cumulative_scroll); |
13 } | 43 } |
14 | 44 |
15 } // namespace webkit_glue | 45 } // namespace webkit_glue |
OLD | NEW |