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

Unified Diff: content/browser/renderer_host/input/fling/fling_curve_impl_android.h

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_impl_android.h
diff --git a/content/browser/renderer_host/input/fling/fling_curve_impl_android.h b/content/browser/renderer_host/input/fling/fling_curve_impl_android.h
new file mode 100644
index 0000000000000000000000000000000000000000..c63ae55fb0770325599f6233498f00db19424195
--- /dev/null
+++ b/content/browser/renderer_host/input/fling/fling_curve_impl_android.h
@@ -0,0 +1,49 @@
+// 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.
+
+#ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_FLING_CURVE_IMPL_ANDROID_H_
+#define CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_FLING_CURVE_IMPL_ANDROID_H_
+
+#include "base/android/scoped_java_ref.h"
+#include "content/browser/renderer_host/input/fling/fling_curve.h"
+#include "content/common/content_export.h"
+#include "ui/gfx/point.h"
+#include "ui/gfx/point_f.h"
+
+namespace content {
+
+class CONTENT_EXPORT FlingCurveImplAndroid : public FlingCurve {
+ public:
+ FlingCurveImplAndroid();
+ virtual ~FlingCurveImplAndroid();
+
+ void StartFling(const gfx::PointF& velocity);
+
+ // Overridden from FlingCurve.
+ virtual bool Apply(double time_in_secs, FlingCurveTarget* target) OVERRIDE;
+
+ static bool RegisterJni(JNIEnv*);
+
+ private:
+ // Returns true if the animation is not yet finished.
+ bool UpdatePosition();
+ gfx::Point GetCurrentPosition();
+ float GetCurrentVelocity();
+ virtual void CancelFling();
+
+ bool is_active_;
+
+ // Java OverScroller instance and methods.
+ base::android::ScopedJavaGlobalRef<jobject> java_scroller_;
+
+ gfx::Point last_position_;
+ gfx::PointF last_velocity_;
+ double last_time_;
+
+ DISALLOW_COPY_AND_ASSIGN(FlingCurveImplAndroid);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_FLING_FLING_CURVE_IMPL_ANDROID_H_

Powered by Google App Engine
This is Rietveld 408576698