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

Side by Side Diff: android_webview/java/src/org/chromium/android_webview/AwContents.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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.ComponentCallbacks2; 7 import android.content.ComponentCallbacks2;
8 import android.content.Context; 8 import android.content.Context;
9 import android.content.pm.PackageManager; 9 import android.content.pm.PackageManager;
10 import android.content.res.Configuration; 10 import android.content.res.Configuration;
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 * @see android.webkit.WebView#onKeyUp(int, KeyEvent) 1219 * @see android.webkit.WebView#onKeyUp(int, KeyEvent)
1220 */ 1220 */
1221 public boolean onKeyUp(int keyCode, KeyEvent event) { 1221 public boolean onKeyUp(int keyCode, KeyEvent event) {
1222 return mContentViewCore.onKeyUp(keyCode, event); 1222 return mContentViewCore.onKeyUp(keyCode, event);
1223 } 1223 }
1224 1224
1225 /** 1225 /**
1226 * @see android.webkit.WebView#dispatchKeyEvent(KeyEvent) 1226 * @see android.webkit.WebView#dispatchKeyEvent(KeyEvent)
1227 */ 1227 */
1228 public boolean dispatchKeyEvent(KeyEvent event) { 1228 public boolean dispatchKeyEvent(KeyEvent event) {
1229 if (AwWebContentsDelegateAdapter.getViewDirectionFromKeyEvent(event) != 0) {
1230 mSettings.setSpatialNavigationEnabled(true);
1231 }
1229 return mContentViewCore.dispatchKeyEvent(event); 1232 return mContentViewCore.dispatchKeyEvent(event);
1230 } 1233 }
1231 1234
1232 /** 1235 /**
1233 * Clears the resource cache. Note that the cache is per-application, so thi s will clear the 1236 * Clears the resource cache. Note that the cache is per-application, so thi s will clear the
1234 * cache for all WebViews used. 1237 * cache for all WebViews used.
1235 * 1238 *
1236 * @param includeDiskFiles if false, only the RAM cache is cleared 1239 * @param includeDiskFiles if false, only the RAM cache is cleared
1237 */ 1240 */
1238 public void clearCache(boolean includeDiskFiles) { 1241 public void clearCache(boolean includeDiskFiles) {
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
1477 //-------------------------------------------------------------------------- ------------------ 1480 //-------------------------------------------------------------------------- ------------------
1478 // View and ViewGroup method implementations 1481 // View and ViewGroup method implementations
1479 //-------------------------------------------------------------------------- ------------------ 1482 //-------------------------------------------------------------------------- ------------------
1480 1483
1481 /** 1484 /**
1482 * @see android.webkit.View#onTouchEvent() 1485 * @see android.webkit.View#onTouchEvent()
1483 */ 1486 */
1484 public boolean onTouchEvent(MotionEvent event) { 1487 public boolean onTouchEvent(MotionEvent event) {
1485 if (mNativeAwContents == 0) return false; 1488 if (mNativeAwContents == 0) return false;
1486 1489
1490 if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
1491 mSettings.setSpatialNavigationEnabled(false);
1492 }
1493
1487 mScrollOffsetManager.setProcessingTouchEvent(true); 1494 mScrollOffsetManager.setProcessingTouchEvent(true);
1488 boolean rv = mContentViewCore.onTouchEvent(event); 1495 boolean rv = mContentViewCore.onTouchEvent(event);
1489 mScrollOffsetManager.setProcessingTouchEvent(false); 1496 mScrollOffsetManager.setProcessingTouchEvent(false);
1490 1497
1491 if (event.getActionMasked() == MotionEvent.ACTION_DOWN) { 1498 if (event.getActionMasked() == MotionEvent.ACTION_DOWN) {
1492 int actionIndex = event.getActionIndex(); 1499 int actionIndex = event.getActionIndex();
1493 1500
1494 // Note this will trigger IPC back to browser even if nothing is hit . 1501 // Note this will trigger IPC back to browser even if nothing is hit .
1495 nativeRequestNewHitTestDataAt(mNativeAwContents, 1502 nativeRequestNewHitTestDataAt(mNativeAwContents,
1496 (int)Math.round(event.getX(actionIndex ) / mDIPScale), 1503 (int)Math.round(event.getX(actionIndex ) / mDIPScale),
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
2042 private native int nativeCapturePicture(int nativeAwContents, int width, int height); 2049 private native int nativeCapturePicture(int nativeAwContents, int width, int height);
2043 private native void nativeEnableOnNewPicture(int nativeAwContents, boolean e nabled); 2050 private native void nativeEnableOnNewPicture(int nativeAwContents, boolean e nabled);
2044 2051
2045 private native void nativeInvokeGeolocationCallback( 2052 private native void nativeInvokeGeolocationCallback(
2046 int nativeAwContents, boolean value, String requestingFrame); 2053 int nativeAwContents, boolean value, String requestingFrame);
2047 2054
2048 private native void nativeSetJsOnlineProperty(int nativeAwContents, boolean networkUp); 2055 private native void nativeSetJsOnlineProperty(int nativeAwContents, boolean networkUp);
2049 2056
2050 private native void nativeTrimMemory(int nativeAwContents, int level); 2057 private native void nativeTrimMemory(int nativeAwContents, int level);
2051 } 2058 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698