1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef WEBKIT_CHILD_FLING_CURVE_CONFIGURATION_H_
6 #define WEBKIT_CHILD_FLING_CURVE_CONFIGURATION_H_
10 #include "base/synchronization/lock.h"
11 #include "third_party/WebKit/public/platform/WebFloatPoint.h"
12 #include "third_party/WebKit/public/platform/WebSize.h"
13 #include "webkit/child/webkit_child_export.h"
16 class WebGestureCurve;
19 namespace webkit_glue {
21 // A class to manage dynamically adjustable parameters controlling the
22 // shape of the fling deacceleration function.
23 class WEBKIT_CHILD_EXPORT FlingCurveConfiguration {
25 FlingCurveConfiguration();
26 virtual ~FlingCurveConfiguration();
28 // Create a touchpad fling curve using the current parameters.
29 blink::WebGestureCurve* CreateForTouchPad(
30 const blink::WebFloatPoint& velocity,
31 const blink::WebSize& cumulativeScroll);
33 // Create a touchscreen fling curve using the current parameters.
34 blink::WebGestureCurve* CreateForTouchScreen(
35 const blink::WebFloatPoint& velocity,
36 const blink::WebSize& cumulativeScroll);
38 // Set the curve parameters.
39 void SetCurveParameters(
40 const std::vector<float>& new_touchpad,
41 const std::vector<float>& new_touchscreen);
44 blink::WebGestureCurve* CreateCore(
45 const std::vector<float>& coefs,
46 const blink::WebFloatPoint& velocity,
47 const blink::WebSize& cumulativeScroll);
49 // Protect access to touchpad_coefs_ and touchscreen_coefs_.
51 std::vector<float> touchpad_coefs_;
52 std::vector<float> touchscreen_coefs_;
54 DISALLOW_COPY_AND_ASSIGN(FlingCurveConfiguration);
57 } // namespace webkit_glue
59 #endif // WEBKIT_CHILD_FLING_CURVE_CONFIGURATION_H_