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

Unified Diff: android_webview/java/src/org/chromium/android_webview/AwSettings.java

Issue 33823005: Dynamically enable spatial navigation based on events (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 7 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
Index: android_webview/java/src/org/chromium/android_webview/AwSettings.java
diff --git a/android_webview/java/src/org/chromium/android_webview/AwSettings.java b/android_webview/java/src/org/chromium/android_webview/AwSettings.java
index deee0a59776e63733066d171cc286f81901e4afe..65a77cb38b7e0a8b303ce33dec05b22a5bb6e798 100644
--- a/android_webview/java/src/org/chromium/android_webview/AwSettings.java
+++ b/android_webview/java/src/org/chromium/android_webview/AwSettings.java
@@ -4,6 +4,7 @@
package org.chromium.android_webview;
+import android.content.pm.PackageManager;
import android.content.Context;
import android.os.Handler;
import android.os.Looper;
@@ -81,6 +82,7 @@ public class AwSettings {
private boolean mMediaPlaybackRequiresUserGesture = true;
private String mDefaultVideoPosterURL;
private float mInitialPageScalePercent = 0;
+ private boolean mSpatialNavigationEnabled; // Default depends on device features.
private final boolean mSupportLegacyQuirks;
@@ -193,6 +195,10 @@ public class AwSettings {
mUserAgent = LazyDefaultUserAgent.sInstance;
onGestureZoomSupportChanged(supportsGestureZoomLocked());
+ // Best-guess a sensible initial value based on the features supported on the device.
+ mSpatialNavigationEnabled = !context.getPackageManager().hasSystemFeature(
+ PackageManager.FEATURE_TOUCHSCREEN);
+
// Respect the system setting for password echoing.
mPasswordEchoEnabled = Settings.System.getInt(context.getContentResolver(),
Settings.System.TEXT_SHOW_PASSWORD, 1) == 1;
@@ -341,6 +347,20 @@ public class AwSettings {
return mInitialPageScalePercent;
}
+ void setSpatialNavigationEnabled(boolean enable) {
+ synchronized (mAwSettingsLock) {
+ if (mSpatialNavigationEnabled != enable) {
+ mSpatialNavigationEnabled = enable;
+ mEventHandler.updateWebkitPreferencesLocked();
+ }
+ }
+ }
+
+ @CalledByNative
+ private boolean getSpatialNavigationLocked() {
+ return mSpatialNavigationEnabled;
+ }
+
/**
* See {@link android.webkit.WebSettings#setNeedInitialFocus}.
*/
@@ -1067,7 +1087,7 @@ public class AwSettings {
}
@CalledByNative
- private boolean getPasswordEchoEnabled() {
+ private boolean getPasswordEchoEnabledLocked() {
return mPasswordEchoEnabled;
}
« no previous file with comments | « android_webview/java/src/org/chromium/android_webview/AwContents.java ('k') | android_webview/lib/main/aw_main_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698