Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Side by Side Diff: content/browser/renderer_host/synthetic_gesture_calculator.cc

Issue 62443007: Replace old with new synthetic gesture framework. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forward declare SyntheticGestureController. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698