OLD | NEW |
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 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 * @see View#dispatchKeyEventPreIme(KeyEvent) | 1392 * @see View#dispatchKeyEventPreIme(KeyEvent) |
1393 */ | 1393 */ |
1394 public boolean dispatchKeyEventPreIme(KeyEvent event) { | 1394 public boolean dispatchKeyEventPreIme(KeyEvent event) { |
1395 try { | 1395 try { |
1396 TraceEvent.begin(); | 1396 TraceEvent.begin(); |
1397 if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && mImeAdapter.isAct
ive()) { | 1397 if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && mImeAdapter.isAct
ive()) { |
1398 mUnfocusOnNextSizeChanged = true; | 1398 mUnfocusOnNextSizeChanged = true; |
1399 } else { | 1399 } else { |
1400 undoScrollFocusedEditableNodeIntoViewIfNeeded(false); | 1400 undoScrollFocusedEditableNodeIntoViewIfNeeded(false); |
1401 } | 1401 } |
1402 mImeAdapter.dispatchKeyEventPreIme(event); | |
1403 return mContainerViewInternals.super_dispatchKeyEventPreIme(event); | 1402 return mContainerViewInternals.super_dispatchKeyEventPreIme(event); |
1404 } finally { | 1403 } finally { |
1405 TraceEvent.end(); | 1404 TraceEvent.end(); |
1406 } | 1405 } |
1407 } | 1406 } |
1408 | 1407 |
1409 /** | 1408 /** |
1410 * @see View#dispatchKeyEvent(KeyEvent) | 1409 * @see View#dispatchKeyEvent(KeyEvent) |
1411 */ | 1410 */ |
1412 public boolean dispatchKeyEvent(KeyEvent event) { | 1411 public boolean dispatchKeyEvent(KeyEvent event) { |
1413 if (mImeAdapter != null && | 1412 if (mImeAdapter != null && |
1414 !mImeAdapter.isNativeImeAdapterAttached() && mNativeContentViewC
ore != 0) { | 1413 !mImeAdapter.isNativeImeAdapterAttached() && mNativeContentViewC
ore != 0) { |
1415 mImeAdapter.attach(nativeGetNativeImeAdapter(mNativeContentViewCore)
); | 1414 mImeAdapter.attach(nativeGetNativeImeAdapter(mNativeContentViewCore)
); |
1416 } | 1415 } |
1417 // The key handling logic is kind of confusing here. | 1416 |
1418 // The purpose of shouldOverrideKeyEvent() is to filter out some keys th
at is critical | 1417 if (getContentViewClient().shouldOverrideKeyEvent(event)) { |
1419 // to browser function but useless in renderer process (for example, the
back button), | 1418 return mContainerViewInternals.super_dispatchKeyEvent(event); |
1420 // so the browser can still respond to these keys in a timely manner whe
n the renderer | 1419 } |
1421 // process is busy/blocked/busted. mImeAdapter.dispatchKeyEvent() forwar
ds the key event | 1420 |
1422 // to the renderer process. If mImeAdapter is bypassed or is not interes
ted to the event, | 1421 if (mKeyboardConnected && mImeAdapter.dispatchKeyEvent(event)) return tr
ue; |
1423 // fall back to the default dispatcher to propagate the event to sub-vie
ws. | 1422 |
1424 return (!getContentViewClient().shouldOverrideKeyEvent(event) | 1423 return mContainerViewInternals.super_dispatchKeyEvent(event); |
1425 && mImeAdapter.dispatchKeyEvent(event)) | |
1426 || mContainerViewInternals.super_dispatchKeyEvent(event); | |
1427 } | 1424 } |
1428 | 1425 |
1429 /** | 1426 /** |
1430 * @see View#onHoverEvent(MotionEvent) | 1427 * @see View#onHoverEvent(MotionEvent) |
1431 * Mouse move events are sent on hover enter, hover move and hover exit. | 1428 * Mouse move events are sent on hover enter, hover move and hover exit. |
1432 * They are sent on hover exit because sometimes it acts as both a hover | 1429 * They are sent on hover exit because sometimes it acts as both a hover |
1433 * move and hover exit. | 1430 * move and hover exit. |
1434 */ | 1431 */ |
1435 public boolean onHoverEvent(MotionEvent event) { | 1432 public boolean onHoverEvent(MotionEvent event) { |
1436 TraceEvent.begin("onHoverEvent"); | 1433 TraceEvent.begin("onHoverEvent"); |
(...skipping 1156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2593 private native void nativeUpdateVSyncParameters(int nativeContentViewCoreImp
l, | 2590 private native void nativeUpdateVSyncParameters(int nativeContentViewCoreImp
l, |
2594 long timebaseMicros, long intervalMicros); | 2591 long timebaseMicros, long intervalMicros); |
2595 | 2592 |
2596 private native boolean nativePopulateBitmapFromCompositor(int nativeContentV
iewCoreImpl, | 2593 private native boolean nativePopulateBitmapFromCompositor(int nativeContentV
iewCoreImpl, |
2597 Bitmap bitmap); | 2594 Bitmap bitmap); |
2598 | 2595 |
2599 private native void nativeSetSize(int nativeContentViewCoreImpl, int width,
int height); | 2596 private native void nativeSetSize(int nativeContentViewCoreImpl, int width,
int height); |
2600 | 2597 |
2601 private native boolean nativeIsRenderWidgetHostViewReady(int nativeContentVi
ewCoreImpl); | 2598 private native boolean nativeIsRenderWidgetHostViewReady(int nativeContentVi
ewCoreImpl); |
2602 } | 2599 } |
OLD | NEW |