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

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: Rebased 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
« no previous file with comments | « no previous file | content/public/android/java/src/org/chromium/content/browser/ImeAdapter.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1390 matching lines...) Expand 10 before | Expand all | Expand 10 after
1401 * @see View#dispatchKeyEventPreIme(KeyEvent) 1401 * @see View#dispatchKeyEventPreIme(KeyEvent)
1402 */ 1402 */
1403 public boolean dispatchKeyEventPreIme(KeyEvent event) { 1403 public boolean dispatchKeyEventPreIme(KeyEvent event) {
1404 try { 1404 try {
1405 TraceEvent.begin(); 1405 TraceEvent.begin();
1406 if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && mImeAdapter.isAct ive()) { 1406 if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && mImeAdapter.isAct ive()) {
1407 mUnfocusOnNextSizeChanged = true; 1407 mUnfocusOnNextSizeChanged = true;
1408 } else { 1408 } else {
1409 undoScrollFocusedEditableNodeIntoViewIfNeeded(false); 1409 undoScrollFocusedEditableNodeIntoViewIfNeeded(false);
1410 } 1410 }
1411 mImeAdapter.dispatchKeyEventPreIme(event);
1412 return mContainerViewInternals.super_dispatchKeyEventPreIme(event); 1411 return mContainerViewInternals.super_dispatchKeyEventPreIme(event);
1413 } finally { 1412 } finally {
1414 TraceEvent.end(); 1413 TraceEvent.end();
1415 } 1414 }
1416 } 1415 }
1417 1416
1418 /** 1417 /**
1419 * @see View#dispatchKeyEvent(KeyEvent) 1418 * @see View#dispatchKeyEvent(KeyEvent)
1420 */ 1419 */
1421 public boolean dispatchKeyEvent(KeyEvent event) { 1420 public boolean dispatchKeyEvent(KeyEvent event) {
1422 if (mImeAdapter != null && 1421 if (mImeAdapter != null &&
1423 !mImeAdapter.isNativeImeAdapterAttached() && mNativeContentViewC ore != 0) { 1422 !mImeAdapter.isNativeImeAdapterAttached() && mNativeContentViewC ore != 0) {
1424 mImeAdapter.attach(nativeGetNativeImeAdapter(mNativeContentViewCore) ); 1423 mImeAdapter.attach(nativeGetNativeImeAdapter(mNativeContentViewCore) );
1425 } 1424 }
1426 // The key handling logic is kind of confusing here. 1425
1427 // The purpose of shouldOverrideKeyEvent() is to filter out some keys th at is critical 1426 if (getContentViewClient().shouldOverrideKeyEvent(event)) {
1428 // to browser function but useless in renderer process (for example, the back button), 1427 return mContainerViewInternals.super_dispatchKeyEvent(event);
1429 // so the browser can still respond to these keys in a timely manner whe n the renderer 1428 }
1430 // process is busy/blocked/busted. mImeAdapter.dispatchKeyEvent() forwar ds the key event 1429
1431 // to the renderer process. If mImeAdapter is bypassed or is not interes ted to the event, 1430 if (mKeyboardConnected && mImeAdapter.dispatchKeyEvent(event)) return tr ue;
1432 // fall back to the default dispatcher to propagate the event to sub-vie ws. 1431
1433 return (!getContentViewClient().shouldOverrideKeyEvent(event) 1432 return mContainerViewInternals.super_dispatchKeyEvent(event);
1434 && mImeAdapter.dispatchKeyEvent(event))
1435 || mContainerViewInternals.super_dispatchKeyEvent(event);
1436 } 1433 }
1437 1434
1438 /** 1435 /**
1439 * @see View#onHoverEvent(MotionEvent) 1436 * @see View#onHoverEvent(MotionEvent)
1440 * Mouse move events are sent on hover enter, hover move and hover exit. 1437 * Mouse move events are sent on hover enter, hover move and hover exit.
1441 * They are sent on hover exit because sometimes it acts as both a hover 1438 * They are sent on hover exit because sometimes it acts as both a hover
1442 * move and hover exit. 1439 * move and hover exit.
1443 */ 1440 */
1444 public boolean onHoverEvent(MotionEvent event) { 1441 public boolean onHoverEvent(MotionEvent event) {
1445 TraceEvent.begin("onHoverEvent"); 1442 TraceEvent.begin("onHoverEvent");
(...skipping 1165 matching lines...) Expand 10 before | Expand all | Expand 10 after
2611 private native void nativeUpdateVSyncParameters(int nativeContentViewCoreImp l, 2608 private native void nativeUpdateVSyncParameters(int nativeContentViewCoreImp l,
2612 long timebaseMicros, long intervalMicros); 2609 long timebaseMicros, long intervalMicros);
2613 2610
2614 private native boolean nativePopulateBitmapFromCompositor(int nativeContentV iewCoreImpl, 2611 private native boolean nativePopulateBitmapFromCompositor(int nativeContentV iewCoreImpl,
2615 Bitmap bitmap); 2612 Bitmap bitmap);
2616 2613
2617 private native void nativeSetSize(int nativeContentViewCoreImpl, int width, int height); 2614 private native void nativeSetSize(int nativeContentViewCoreImpl, int width, int height);
2618 2615
2619 private native boolean nativeIsRenderWidgetHostViewReady(int nativeContentVi ewCoreImpl); 2616 private native boolean nativeIsRenderWidgetHostViewReady(int nativeContentVi ewCoreImpl);
2620 } 2617 }
OLDNEW
« no previous file with comments | « no previous file | content/public/android/java/src/org/chromium/content/browser/ImeAdapter.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698