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
3 // found in the LICENSE file.
5 #include "content/browser/renderer_host/synthetic_gesture_calculator.h"
10 const float kDefaultPositionDelta = 10.0f;
17 SyntheticGestureCalculator::SyntheticGestureCalculator() {
20 SyntheticGestureCalculator::~SyntheticGestureCalculator() {
23 float SyntheticGestureCalculator::GetDelta(
24 base::TimeTicks now, base::TimeDelta desired_interval) {
25 float position_delta = kDefaultPositionDelta;
26 if (!last_tick_time_.is_null()) {
27 float velocity = kDefaultPositionDelta /
28 (float)desired_interval.InMillisecondsF();
29 float time_delta = (now - last_tick_time_).InMillisecondsF();
30 position_delta = velocity * time_delta;
33 last_tick_time_ = now;
34 return position_delta;
37 } // namespace content