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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.android_webview; 5 package org.chromium.android_webview;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 import android.os.Handler; 8 import android.os.Handler;
9 import android.os.Looper; 9 import android.os.Looper;
10 import android.os.Message; 10 import android.os.Message;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 private boolean mSupportMultipleWindows = false; 74 private boolean mSupportMultipleWindows = false;
75 private PluginState mPluginState = PluginState.OFF; 75 private PluginState mPluginState = PluginState.OFF;
76 private boolean mAppCacheEnabled = false; 76 private boolean mAppCacheEnabled = false;
77 private boolean mDomStorageEnabled = false; 77 private boolean mDomStorageEnabled = false;
78 private boolean mDatabaseEnabled = false; 78 private boolean mDatabaseEnabled = false;
79 private boolean mUseWideViewport = false; 79 private boolean mUseWideViewport = false;
80 private boolean mLoadWithOverviewMode = false; 80 private boolean mLoadWithOverviewMode = false;
81 private boolean mMediaPlaybackRequiresUserGesture = true; 81 private boolean mMediaPlaybackRequiresUserGesture = true;
82 private String mDefaultVideoPosterURL; 82 private String mDefaultVideoPosterURL;
83 private float mInitialPageScalePercent = 0; 83 private float mInitialPageScalePercent = 0;
84 private boolean mSpatialNavigationEnabled; // Default depends on device fea utres.
sgurun-gerrit only 2013/10/22 17:18:00 s/feautres/features/
joth 2013/10/22 22:02:41 Done.
84 85
85 private final boolean mSupportLegacyQuirks; 86 private final boolean mSupportLegacyQuirks;
86 87
87 private final boolean mPasswordEchoEnabled; 88 private final boolean mPasswordEchoEnabled;
88 89
89 // Not accessed by the native side. 90 // Not accessed by the native side.
90 private boolean mBlockNetworkLoads; // Default depends on permission of emb edding APK. 91 private boolean mBlockNetworkLoads; // Default depends on permission of emb edding APK.
91 private boolean mAllowContentUrlAccess = true; 92 private boolean mAllowContentUrlAccess = true;
92 private boolean mAllowFileUrlAccess = true; 93 private boolean mAllowFileUrlAccess = true;
93 private int mCacheMode = WebSettings.LOAD_DEFAULT; 94 private int mCacheMode = WebSettings.LOAD_DEFAULT;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 mBlockNetworkLoads = !hasInternetPermission; 187 mBlockNetworkLoads = !hasInternetPermission;
187 188
188 if (isAccessFromFileURLsGrantedByDefault) { 189 if (isAccessFromFileURLsGrantedByDefault) {
189 mAllowUniversalAccessFromFileURLs = true; 190 mAllowUniversalAccessFromFileURLs = true;
190 mAllowFileAccessFromFileURLs = true; 191 mAllowFileAccessFromFileURLs = true;
191 } 192 }
192 193
193 mUserAgent = LazyDefaultUserAgent.sInstance; 194 mUserAgent = LazyDefaultUserAgent.sInstance;
194 onGestureZoomSupportChanged(supportsGestureZoomLocked()); 195 onGestureZoomSupportChanged(supportsGestureZoomLocked());
195 196
197 // Best-guess a sensible initial value based on the features suppor ted on the device.
dmazzoni 2013/10/22 06:47:55 nit: delete extra space after "guess"
joth 2013/10/22 22:02:41 Done.
198 mSpatialNavigationEnabled = !context.getPackageManager().hasSystemFe ature(
199 PackageManager.FEATURE_TOUCHSCREEN);
200
196 // Respect the system setting for password echoing. 201 // Respect the system setting for password echoing.
197 mPasswordEchoEnabled = Settings.System.getInt(context.getContentReso lver(), 202 mPasswordEchoEnabled = Settings.System.getInt(context.getContentReso lver(),
198 Settings.System.TEXT_SHOW_PASSWORD, 1) == 1; 203 Settings.System.TEXT_SHOW_PASSWORD, 1) == 1;
199 204
200 mSupportLegacyQuirks = supportsLegacyQuirks; 205 mSupportLegacyQuirks = supportsLegacyQuirks;
201 } 206 }
202 // Defer initializing the native side until a native WebContents instanc e is set. 207 // Defer initializing the native side until a native WebContents instanc e is set.
203 } 208 }
204 209
205 @CalledByNative 210 @CalledByNative
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 }); 339 });
335 } 340 }
336 } 341 }
337 } 342 }
338 343
339 @CalledByNative 344 @CalledByNative
340 private float getInitialPageScalePercentLocked() { 345 private float getInitialPageScalePercentLocked() {
341 return mInitialPageScalePercent; 346 return mInitialPageScalePercent;
342 } 347 }
343 348
349 void setSpatialNavigationEnabled(boolean enable) {
350 synchronized (mAwSettingsLock) {
351 if (mSpatialNavigationEnabled != enable) {
352 mSpatialNavigationEnabled = enable;
353 mEventHandler.updateWebkitPreferencesLocked();
dmazzoni 2013/10/22 06:47:55 Does this have the right effect, visually? I didn'
joth 2013/10/22 22:02:41 I think you're right that when transitioning enabl
354 }
355 }
356 }
357
358 @CalledByNative
359 private boolean getSpatialNavigationLocked() {
360 return mSpatialNavigationEnabled;
361 }
362
344 /** 363 /**
345 * See {@link android.webkit.WebSettings#setNeedInitialFocus}. 364 * See {@link android.webkit.WebSettings#setNeedInitialFocus}.
346 */ 365 */
347 public boolean shouldFocusFirstNode() { 366 public boolean shouldFocusFirstNode() {
348 synchronized(mAwSettingsLock) { 367 synchronized(mAwSettingsLock) {
349 return mShouldFocusFirstNode; 368 return mShouldFocusFirstNode;
350 } 369 }
351 } 370 }
352 371
353 /** 372 /**
(...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1060 return mUseWideViewport; 1079 return mUseWideViewport;
1061 } 1080 }
1062 } 1081 }
1063 1082
1064 @CalledByNative 1083 @CalledByNative
1065 private boolean getUseWideViewportLocked() { 1084 private boolean getUseWideViewportLocked() {
1066 return mUseWideViewport; 1085 return mUseWideViewport;
1067 } 1086 }
1068 1087
1069 @CalledByNative 1088 @CalledByNative
1070 private boolean getPasswordEchoEnabled() { 1089 private boolean getPasswordEchoEnabledLocked() {
1071 return mPasswordEchoEnabled; 1090 return mPasswordEchoEnabled;
1072 } 1091 }
1073 1092
1074 /** 1093 /**
1075 * See {@link android.webkit.WebSettings#setAppCacheEnabled}. 1094 * See {@link android.webkit.WebSettings#setAppCacheEnabled}.
1076 */ 1095 */
1077 public void setAppCacheEnabled(boolean flag) { 1096 public void setAppCacheEnabled(boolean flag) {
1078 synchronized (mAwSettingsLock) { 1097 synchronized (mAwSettingsLock) {
1079 if (mAppCacheEnabled != flag) { 1098 if (mAppCacheEnabled != flag) {
1080 mAppCacheEnabled = flag; 1099 mAppCacheEnabled = flag;
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
1373 private native void nativeUpdateInitialPageScaleLocked(int nativeAwSettings) ; 1392 private native void nativeUpdateInitialPageScaleLocked(int nativeAwSettings) ;
1374 1393
1375 private native void nativeUpdateUserAgentLocked(int nativeAwSettings); 1394 private native void nativeUpdateUserAgentLocked(int nativeAwSettings);
1376 1395
1377 private native void nativeUpdateWebkitPreferencesLocked(int nativeAwSettings ); 1396 private native void nativeUpdateWebkitPreferencesLocked(int nativeAwSettings );
1378 1397
1379 private static native String nativeGetDefaultUserAgent(); 1398 private static native String nativeGetDefaultUserAgent();
1380 1399
1381 private native void nativeUpdateFormDataPreferencesLocked(int nativeAwSettin gs); 1400 private native void nativeUpdateFormDataPreferencesLocked(int nativeAwSettin gs);
1382 } 1401 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698