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

Unified Diff: content/browser/renderer_host/input/fling/fling_curve_configuration.cc

Issue 41703006: Move fling implementation from renderer to browser: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/input/fling/fling_curve_configuration.cc
diff --git a/content/browser/renderer_host/input/fling/fling_curve_configuration.cc b/content/browser/renderer_host/input/fling/fling_curve_configuration.cc
new file mode 100644
index 0000000000000000000000000000000000000000..07ee20eec5acd353b564b131f54f16f800e4b9d2
--- /dev/null
+++ b/content/browser/renderer_host/input/fling/fling_curve_configuration.cc
@@ -0,0 +1,55 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/renderer_host/input/fling/fling_curve_configuration.h"
+
+#include "base/logging.h"
+#include "content/browser/renderer_host/input/fling/fling_curve.h"
+#include "content/browser/renderer_host/input/fling/fling_curve_impl.h"
+
+namespace content {
+
+FlingCurveConfiguration::FlingCurveConfiguration() { }
+
+FlingCurveConfiguration::~FlingCurveConfiguration() { }
+
+void FlingCurveConfiguration::SetCurveParameters(
+ const std::vector<float>& new_touchpad,
+ const std::vector<float>& new_touchscreen) {
+ DCHECK(new_touchpad.size() >= 3);
+ DCHECK(new_touchscreen.size() >= 3);
+ base::AutoLock scoped_lock(lock_);
+ touchpad_coefs_ = new_touchpad;
+ touchscreen_coefs_ = new_touchscreen;
+}
+
+FlingCurve* FlingCurveConfiguration::CreateCore(
+ const std::vector<float>& coefs,
+ const gfx::PointF& velocity,
+ const gfx::Point& cumulative_scroll) {
+ float p0, p1, p2;
+
+ {
+ base::AutoLock scoped_lock(lock_);
+ p0 = coefs[0];
+ p1 = coefs[1];
+ p2 = coefs[2];
+ }
+
+ return FlingCurveImpl::Create(velocity, p0, p1, p2, cumulative_scroll);
+}
+
+FlingCurve* FlingCurveConfiguration::CreateForTouchPad(
+ const gfx::PointF& velocity,
+ const gfx::Point& cumulative_scroll) {
+ return CreateCore(touchpad_coefs_, velocity, cumulative_scroll);
+}
+
+FlingCurve* FlingCurveConfiguration::CreateForTouchScreen(
+ const gfx::PointF& velocity,
+ const gfx::Point& cumulative_scroll) {
+ return CreateCore(touchscreen_coefs_, velocity, cumulative_scroll);
+}
+
+} // namespace webkit_glue

Powered by Google App Engine
This is Rietveld 408576698