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

Unified Diff: chrome/android/java_staging/src/org/chromium/chrome/browser/compositor/layouts/EdgeSwipeHandlerLayoutDelegate.java

Issue 1141283003: Upstream oodles of Chrome for Android code into Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final patch? Created 5 years, 7 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
Index: chrome/android/java_staging/src/org/chromium/chrome/browser/compositor/layouts/EdgeSwipeHandlerLayoutDelegate.java
diff --git a/chrome/android/java_staging/src/org/chromium/chrome/browser/compositor/layouts/EdgeSwipeHandlerLayoutDelegate.java b/chrome/android/java_staging/src/org/chromium/chrome/browser/compositor/layouts/EdgeSwipeHandlerLayoutDelegate.java
new file mode 100644
index 0000000000000000000000000000000000000000..351bfef132f4755581754c341acbb4cb8c61041c
--- /dev/null
+++ b/chrome/android/java_staging/src/org/chromium/chrome/browser/compositor/layouts/EdgeSwipeHandlerLayoutDelegate.java
@@ -0,0 +1,50 @@
+// Copyright 2015 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.
+
+package org.chromium.chrome.browser.compositor.layouts;
+
+import org.chromium.chrome.browser.compositor.layouts.eventfilter.EdgeSwipeEventFilter.ScrollDirection;
+import org.chromium.chrome.browser.compositor.layouts.eventfilter.EdgeSwipeHandler;
+import org.chromium.chrome.browser.compositor.layouts.eventfilter.EmptyEdgeSwipeHandler;
+
+/**
+ * A {@link EdgeSwipeHandler} that takes a {@link LayoutProvider} and delegates all swipe events
+ * to {@link LayoutProvider#getActiveLayout()}.
+ */
+public class EdgeSwipeHandlerLayoutDelegate extends EmptyEdgeSwipeHandler {
+ private final LayoutProvider mLayoutProvider;
+
+ /**
+ * Creates an instance of the {@link EdgeSwipeHandlerLayoutDelegate}.
+ * @param provider A {@link LayoutProvider} instance.
+ */
+ public EdgeSwipeHandlerLayoutDelegate(LayoutProvider provider) {
+ mLayoutProvider = provider;
+ }
+
+ @Override
+ public void swipeStarted(ScrollDirection direction, float x, float y) {
+ if (mLayoutProvider.getActiveLayout() == null) return;
+ mLayoutProvider.getActiveLayout().swipeStarted(LayoutManager.time(), direction, x, y);
+ }
+
+ @Override
+ public void swipeUpdated(float x, float y, float dx, float dy, float tx, float ty) {
+ if (mLayoutProvider.getActiveLayout() == null) return;
+ mLayoutProvider.getActiveLayout().swipeUpdated(LayoutManager.time(), x, y, dx, dy, tx, ty);
+ }
+
+ @Override
+ public void swipeFinished() {
+ if (mLayoutProvider.getActiveLayout() == null) return;
+ mLayoutProvider.getActiveLayout().swipeFinished(LayoutManager.time());
+ }
+
+ @Override
+ public void swipeFlingOccurred(float x, float y, float tx, float ty, float vx, float vy) {
+ if (mLayoutProvider.getActiveLayout() == null) return;
+ mLayoutProvider.getActiveLayout().swipeFlingOccurred(
+ LayoutManager.time(), x, y, tx, ty, vx, vy);
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698