Separate Simple Backend creation from initialization.
[chromium-blink-merge.git] / webkit / glue / fling_curve_configuration.h
blob548c530b59fef111fbe64846b7ee3779db58795e
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_GLUE_FLINGCURVECONFIGURATION_H_
6 #define WEBKIT_GLUE_FLINGCURVECONFIGURATION_H_
8 #include <vector>
10 #include "base/synchronization/lock.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h"
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
14 namespace WebKit {
15 class WebGestureCurve;
18 namespace webkit_glue {
20 // A class to manage dynamically adjustable parameters controlling the
21 // shape of the fling deacceleration function.
22 class FlingCurveConfiguration {
23 public:
24 FlingCurveConfiguration();
25 virtual ~FlingCurveConfiguration();
27 // Create a touchpad fling curve using the current parameters.
28 WebKit::WebGestureCurve* CreateForTouchPad(
29 const WebKit::WebFloatPoint& velocity,
30 const WebKit::WebSize& cumulativeScroll);
32 // Create a touchscreen fling curve using the current parameters.
33 WebKit::WebGestureCurve* CreateForTouchScreen(
34 const WebKit::WebFloatPoint& velocity,
35 const WebKit::WebSize& cumulativeScroll);
37 // Set the curve parameters.
38 void SetCurveParameters(
39 const std::vector<float>& new_touchpad,
40 const std::vector<float>& new_touchscreen);
42 private:
43 WebKit::WebGestureCurve* CreateCore(
44 const std::vector<float>& coefs,
45 const WebKit::WebFloatPoint& velocity,
46 const WebKit::WebSize& cumulativeScroll);
48 // Protect access to touchpad_coefs_ and touchscreen_coefs_.
49 base::Lock lock_;
50 std::vector<float> touchpad_coefs_;
51 std::vector<float> touchscreen_coefs_;
53 DISALLOW_COPY_AND_ASSIGN(FlingCurveConfiguration);
56 } // namespace webkit_glue
58 #endif // WEBKIT_GLUE_FLINGCURVECONFIGURATION_H_