OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #include "content/browser/renderer_host/synthetic_gesture_calculator.h" | |
6 | |
7 | |
8 namespace { | |
9 | |
10 const float kDefaultPositionDelta = 10.0f; | |
11 | |
12 } | |
13 | |
14 | |
15 namespace content { | |
16 | |
17 SyntheticGestureCalculator::SyntheticGestureCalculator() { | |
18 } | |
19 | |
20 SyntheticGestureCalculator::~SyntheticGestureCalculator() { | |
21 } | |
22 | |
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; | |
31 } | |
32 | |
33 last_tick_time_ = now; | |
34 return position_delta; | |
35 } | |
36 | |
37 } // namespace content | |
OLD | NEW |