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

Unified Diff: ui/events/android/scroller.h

Issue 634373003: Consolidate content fling implementations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix win build Created 6 years, 2 months 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
« no previous file with comments | « ui/events/android/OWNERS ('k') | ui/events/android/scroller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/android/scroller.h
diff --git a/ui/gfx/android/scroller.h b/ui/events/android/scroller.h
similarity index 85%
rename from ui/gfx/android/scroller.h
rename to ui/events/android/scroller.h
index 39d7255dc8771be2495122ae04342194e7e8333c..f276a836877e7ed72f7692c8fd1e28b43a1b2f54 100644
--- a/ui/gfx/android/scroller.h
+++ b/ui/events/android/scroller.h
@@ -2,18 +2,20 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UI_GFX_ANDROID_SCROLLER_H_
-#define UI_GFX_ANDROID_SCROLLER_H_
+#ifndef UI_EVENTS_ANDROID_SCROLLER_H_
+#define UI_EVENTS_ANDROID_SCROLLER_H_
#include "base/time/time.h"
-#include "ui/gfx/gfx_export.h"
+#include "ui/events/events_base_export.h"
+#include "ui/events/gesture_curve.h"
+#include "ui/gfx/geometry/vector2d_f.h"
-namespace gfx {
+namespace ui {
// Native port of android.widget.Scroller.
// * Change-Id: I4365946f890a76fcfa78ca9d69f2a8e0848095a9
// * Please update the Change-Id as upstream Android changes are pulled.
-class GFX_EXPORT Scroller {
+class EVENTS_BASE_EXPORT Scroller : public GestureCurve {
public:
struct Config {
Config();
@@ -26,7 +28,12 @@ class GFX_EXPORT Scroller {
};
explicit Scroller(const Config& config);
- ~Scroller();
+ virtual ~Scroller();
+
+ // GestureCurve implementation.
+ virtual bool ComputeScrollOffset(base::TimeTicks time,
+ gfx::Vector2dF* offset,
+ gfx::Vector2dF* velocity) override;
// Start scrolling by providing a starting point and the distance to travel.
// The default value of 250 milliseconds will be used for the duration.
@@ -57,10 +64,6 @@ class GFX_EXPORT Scroller {
float max_y,
base::TimeTicks start_time);
- // Call this when you want to know the new location. If it returns true,
- // the animation is not yet finished.
- bool ComputeScrollOffset(base::TimeTicks time);
-
// Extend the scroll animation by |extend|. This allows a running animation
// to scroll further and longer when used with |SetFinalX()| or |SetFinalY()|.
void ExtendDuration(base::TimeDelta extend);
@@ -102,7 +105,7 @@ class GFX_EXPORT Scroller {
FLING_MODE,
};
- void OnDurationChanged();
+ bool ComputeScrollOffsetInternal(base::TimeTicks time);
void RecomputeDeltas();
double GetSplineDeceleration(float velocity) const;
@@ -143,6 +146,6 @@ class GFX_EXPORT Scroller {
float tuning_coeff_;
};
-} // namespace gfx
+} // namespace ui
-#endif // UI_GFX_ANDROID_SCROLLER_H_
+#endif // UI_EVENTS_ANDROID_SCROLLER_H_
« no previous file with comments | « ui/events/android/OWNERS ('k') | ui/events/android/scroller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698