summaryrefslogtreecommitdiffstats
path: root/content/child/web_gesture_curve_impl.h
diff options
context:
space:
mode:
authorjdduke <jdduke@chromium.org>2014-10-10 11:00:18 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-10 18:00:37 +0000
commit1d6fc87072bd9f8ea7908cb5af19d7ef6cd0e18c (patch)
tree0f62f5a9f499e5926e764d4495bda2331fbb66d2 /content/child/web_gesture_curve_impl.h
parentbee8d3d4e4b4c2f22b15f3a598a38a6b2c7c5fe2 (diff)
downloadchromium_src-1d6fc87072bd9f8ea7908cb5af19d7ef6cd0e18c.zip
chromium_src-1d6fc87072bd9f8ea7908cb5af19d7ef6cd0e18c.tar.gz
chromium_src-1d6fc87072bd9f8ea7908cb5af19d7ef6cd0e18c.tar.bz2
Consolidate content fling implementations
Provide a single implementation of WebGestureCurve, instead relying on platform-specific ui::GestureCurve implementations for core functionality. This eliminates the duplicated curve code used for content and view-targetted flings on Aura. BUG=420214 Review URL: https://codereview.chromium.org/634373003 Cr-Commit-Position: refs/heads/master@{#299136}
Diffstat (limited to 'content/child/web_gesture_curve_impl.h')
-rw-r--r--content/child/web_gesture_curve_impl.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/content/child/web_gesture_curve_impl.h b/content/child/web_gesture_curve_impl.h
new file mode 100644
index 0000000..cb0d0bf
--- /dev/null
+++ b/content/child/web_gesture_curve_impl.h
@@ -0,0 +1,53 @@
+// Copyright 2014 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_CHILD_WEB_GESTURE_CURVE_IMPL_H_
+#define CONTENT_CHILD_WEB_GESTURE_CURVE_IMPL_H_
+
+#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "content/common/content_export.h"
+#include "third_party/WebKit/public/platform/WebGestureCurve.h"
+#include "ui/gfx/geometry/vector2d_f.h"
+
+namespace blink {
+class WebGestureCurveTarget;
+}
+
+namespace ui {
+class GestureCurve;
+}
+
+namespace content {
+
+class CONTENT_EXPORT WebGestureCurveImpl
+ : public NON_EXPORTED_BASE(blink::WebGestureCurve) {
+ public:
+ static scoped_ptr<blink::WebGestureCurve> CreateFromDefaultPlatformCurve(
+ const gfx::Vector2dF& initial_velocity,
+ const gfx::Vector2dF& initial_offset);
+ static scoped_ptr<blink::WebGestureCurve> CreateFrom(
+ scoped_ptr<ui::GestureCurve> curve,
+ const gfx::Vector2dF& initial_offset);
+
+ virtual ~WebGestureCurveImpl();
+
+ // WebGestureCurve implementation.
+ virtual bool apply(double time,
+ blink::WebGestureCurveTarget* target) override;
+
+ private:
+ WebGestureCurveImpl(scoped_ptr<ui::GestureCurve> curve,
+ const gfx::Vector2dF& initial_offset);
+
+ scoped_ptr<ui::GestureCurve> curve_;
+
+ gfx::Vector2dF last_offset_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebGestureCurveImpl);
+};
+
+} // namespace content
+
+#endif // CONTENT_CHILD_WEB_GESTURE_CURVE_IMPL_H_