OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/renderer_host/input/fling/fling_curve_impl.h" | 5 #include "content/browser/renderer_host/input/fling/fling_curve_impl.h" |
6 | 6 |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 } | 149 } |
150 | 150 |
151 return false; | 151 return false; |
152 } | 152 } |
153 | 153 |
154 // static | 154 // static |
155 FlingCurve* FlingCurve::Create(WebKit::WebGestureEvent::SourceDevice source, | 155 FlingCurve* FlingCurve::Create(WebKit::WebGestureEvent::SourceDevice source, |
156 const gfx::PointF& velocity, | 156 const gfx::PointF& velocity, |
157 const gfx::Point& cumulative_scroll) { | 157 const gfx::Point& cumulative_scroll) { |
158 FlingCurveConfiguration config; | 158 FlingCurveConfiguration config; |
159 // TODO(varunjain): Set these parameters from actual preferences. | 159 static const float touchpad_profile[] = { |
160 content::RendererPreferences def_prefs; | 160 ui::GestureConfiguration::touchpad_fling_curve_alpha(), |
161 config.SetCurveParameters(def_prefs.touchpad_fling_profile, | 161 ui::GestureConfiguration::touchpad_fling_curve_beta(), |
162 def_prefs.touchscreen_fling_profile); | 162 ui::GestureConfiguration::touchpad_fling_curve_gamma() |
| 163 }; |
| 164 static const float touchscreen_profile[] = { |
| 165 ui::GestureConfiguration::touchscreen_fling_curve_alpha(), |
| 166 ui::GestureConfiguration::touchscreen_fling_curve_beta(), |
| 167 ui::GestureConfiguration::touchscreen_fling_curve_gamma() |
| 168 }; |
| 169 static const std::vector<float> touchpad_profile_vec(touchpad_profile, |
| 170 touchpad_profile + 3); |
| 171 static const std::vector<float> touchscreen_profile_vec(touchscreen_profile, |
| 172 touchscreen_profile + 3); |
| 173 config.SetCurveParameters(touchpad_profile_vec, touchscreen_profile_vec); |
163 if (source == WebKit::WebGestureEvent::Touchscreen) | 174 if (source == WebKit::WebGestureEvent::Touchscreen) |
164 return config.CreateForTouchScreen(velocity, cumulative_scroll); | 175 return config.CreateForTouchScreen(velocity, cumulative_scroll); |
165 return config.CreateForTouchPad(velocity, cumulative_scroll); | 176 return config.CreateForTouchPad(velocity, cumulative_scroll); |
166 } | 177 } |
167 | 178 |
168 } // namespace content | 179 } // namespace content |
OLD | NEW |