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

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

Issue 11914003: Start sending synthetic keyevents for enter and tab in Android IME (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 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.content.browser; 5 package org.chromium.content.browser;
6 6
7 import android.app.Activity; 7 import android.app.Activity;
8 import android.app.ActivityManager; 8 import android.app.ActivityManager;
9 import android.content.Context; 9 import android.content.Context;
10 import android.content.pm.ActivityInfo; 10 import android.content.pm.ActivityInfo;
(...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 * @see View#dispatchKeyEventPreIme(KeyEvent) 1387 * @see View#dispatchKeyEventPreIme(KeyEvent)
1388 */ 1388 */
1389 public boolean dispatchKeyEventPreIme(KeyEvent event) { 1389 public boolean dispatchKeyEventPreIme(KeyEvent event) {
1390 try { 1390 try {
1391 TraceEvent.begin(); 1391 TraceEvent.begin();
1392 if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && mImeAdapter.isAct ive()) { 1392 if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && mImeAdapter.isAct ive()) {
1393 mUnfocusOnNextSizeChanged = true; 1393 mUnfocusOnNextSizeChanged = true;
1394 } else { 1394 } else {
1395 undoScrollFocusedEditableNodeIntoViewIfNeeded(false); 1395 undoScrollFocusedEditableNodeIntoViewIfNeeded(false);
1396 } 1396 }
1397 mImeAdapter.dispatchKeyEventPreIme(event);
1398 return mContainerViewInternals.super_dispatchKeyEventPreIme(event); 1397 return mContainerViewInternals.super_dispatchKeyEventPreIme(event);
1399 } finally { 1398 } finally {
1400 TraceEvent.end(); 1399 TraceEvent.end();
1401 } 1400 }
1402 } 1401 }
1403 1402
1404 /** 1403 /**
1405 * @see View#dispatchKeyEvent(KeyEvent) 1404 * @see View#dispatchKeyEvent(KeyEvent)
1406 */ 1405 */
1407 public boolean dispatchKeyEvent(KeyEvent event) { 1406 public boolean dispatchKeyEvent(KeyEvent event) {
1408 if (mImeAdapter != null && 1407 if (mImeAdapter != null &&
1409 !mImeAdapter.isNativeImeAdapterAttached() && mNativeContentViewC ore != 0) { 1408 !mImeAdapter.isNativeImeAdapterAttached() && mNativeContentViewC ore != 0) {
1410 mImeAdapter.attach(nativeGetNativeImeAdapter(mNativeContentViewCore) ); 1409 mImeAdapter.attach(nativeGetNativeImeAdapter(mNativeContentViewCore) );
1411 } 1410 }
1412 // The key handling logic is kind of confusing here. 1411 // The key handling logic is kind of confusing here.
1413 // The purpose of shouldOverrideKeyEvent() is to filter out some keys th at is critical 1412 // The purpose of shouldOverrideKeyEvent() is to filter out some keys th at is critical
1414 // to browser function but useless in renderer process (for example, the back button), 1413 // to browser function but useless in renderer process (for example, the back button),
1415 // so the browser can still respond to these keys in a timely manner whe n the renderer 1414 // so the browser can still respond to these keys in a timely manner whe n the renderer
1416 // process is busy/blocked/busted. mImeAdapter.dispatchKeyEvent() forwar ds the key event 1415 // process is busy/blocked/busted. mImeAdapter.dispatchKeyEvent() forwar ds the key event
1417 // to the renderer process. If mImeAdapter is bypassed or is not interes ted to the event, 1416 // to the renderer process. If mImeAdapter is bypassed or is not interes ted to the event,
1418 // fall back to the default dispatcher to propagate the event to sub-vie ws. 1417 // fall back to the default dispatcher to propagate the event to sub-vie ws.
1419 return (!getContentViewClient().shouldOverrideKeyEvent(event) 1418 return (!getContentViewClient().shouldOverrideKeyEvent(event)
1420 && mImeAdapter.dispatchKeyEvent(event)) 1419 && (mKeyboardConnected && mImeAdapter.dispatchKeyEvent(event)))
aurimas (slooooooooow) 2013/01/16 00:39:57 Could we rewrite this return statement into a clea
Yusuf 2013/01/16 08:07:57 Done.
1421 || mContainerViewInternals.super_dispatchKeyEvent(event); 1420 || mContainerViewInternals.super_dispatchKeyEvent(event);
1422 } 1421 }
1423 1422
1424 /** 1423 /**
1425 * @see View#onHoverEvent(MotionEvent) 1424 * @see View#onHoverEvent(MotionEvent)
1426 * Mouse move events are sent on hover enter, hover move and hover exit. 1425 * Mouse move events are sent on hover enter, hover move and hover exit.
1427 * They are sent on hover exit because sometimes it acts as both a hover 1426 * They are sent on hover exit because sometimes it acts as both a hover
1428 * move and hover exit. 1427 * move and hover exit.
1429 */ 1428 */
1430 public boolean onHoverEvent(MotionEvent event) { 1429 public boolean onHoverEvent(MotionEvent event) {
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after
2586 private native void nativeUpdateVSyncParameters(int nativeContentViewCoreImp l, 2585 private native void nativeUpdateVSyncParameters(int nativeContentViewCoreImp l,
2587 long timebaseMicros, long intervalMicros); 2586 long timebaseMicros, long intervalMicros);
2588 2587
2589 private native boolean nativePopulateBitmapFromCompositor(int nativeContentV iewCoreImpl, 2588 private native boolean nativePopulateBitmapFromCompositor(int nativeContentV iewCoreImpl,
2590 Bitmap bitmap); 2589 Bitmap bitmap);
2591 2590
2592 private native void nativeSetSize(int nativeContentViewCoreImpl, int width, int height); 2591 private native void nativeSetSize(int nativeContentViewCoreImpl, int width, int height);
2593 2592
2594 private native boolean nativeIsRenderWidgetHostViewReady(int nativeContentVi ewCoreImpl); 2593 private native boolean nativeIsRenderWidgetHostViewReady(int nativeContentVi ewCoreImpl);
2595 } 2594 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698