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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java

Issue 1288243004: Enable zoom through gamedpad trigger joystick (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed previous comments Created 4 years, 11 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: content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
index b7bbcf4a397e658a310bdee6820141c556d4b7cd..1c1df9bc3b211691871a5c92a0e47e315a6e627e 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java
@@ -64,6 +64,7 @@ import org.chromium.content.browser.input.GamepadList;
import org.chromium.content.browser.input.ImeAdapter;
import org.chromium.content.browser.input.InputMethodManagerWrapper;
import org.chromium.content.browser.input.JoystickScrollProvider;
+import org.chromium.content.browser.input.JoystickZoomProvider;
import org.chromium.content.browser.input.LegacyPastePopupMenu;
import org.chromium.content.browser.input.PastePopupMenu;
import org.chromium.content.browser.input.PastePopupMenu.PastePopupMenuDelegate;
@@ -494,6 +495,9 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
// Provides smooth gamepad joystick-driven scrolling.
private final JoystickScrollProvider mJoystickScrollProvider;
+ // Provides smooth gamepad joystick-driven zooming.
+ private JoystickZoomProvider mJoystickZoomProvider;
+
private boolean mIsMobileOptimizedHint;
// Tracks whether a selection is currently active. When applied to selected text, indicates
@@ -1726,6 +1730,10 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
}
} else if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) {
if (mJoystickScrollProvider.onMotion(event)) return true;
+ if (mJoystickZoomProvider == null) {
+ mJoystickZoomProvider = new JoystickZoomProvider(this);
+ }
+ if (mJoystickZoomProvider.onMotion(event)) return true;
}
return mContainerViewInternals.super_onGenericMotionEvent(event);
}
@@ -2720,6 +2728,24 @@ public class ContentViewCore implements AccessibilityStateChangeListener, Screen
return true;
}
+ public boolean pinchBegin(int xPix, int yPix) {
+ if (mNativeContentViewCore == 0) return false;
+ nativePinchBegin(mNativeContentViewCore, SystemClock.uptimeMillis(), xPix, yPix);
+ return true;
+ }
+
+ public boolean pinchBy(int xPix, int yPix, float delta) {
+ if (mNativeContentViewCore == 0) return false;
+ nativePinchBy(mNativeContentViewCore, SystemClock.uptimeMillis(), xPix, yPix, delta);
+ return true;
+ }
+
+ public boolean pinchEnd() {
+ if (mNativeContentViewCore == 0) return false;
+ nativePinchEnd(mNativeContentViewCore, SystemClock.uptimeMillis());
+ return true;
+ }
+
/**
* Invokes the graphical zoom picker widget for this ContentView.
*/

Powered by Google App Engine
This is Rietveld 408576698