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 1336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1347 * @see View#dispatchKeyEventPreIme(KeyEvent) | 1347 * @see View#dispatchKeyEventPreIme(KeyEvent) |
1348 */ | 1348 */ |
1349 public boolean dispatchKeyEventPreIme(KeyEvent event) { | 1349 public boolean dispatchKeyEventPreIme(KeyEvent event) { |
1350 try { | 1350 try { |
1351 TraceEvent.begin(); | 1351 TraceEvent.begin(); |
1352 if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && mImeAdapter.isAct
ive()) { | 1352 if (event.getKeyCode() == KeyEvent.KEYCODE_BACK && mImeAdapter.isAct
ive()) { |
1353 mUnfocusOnNextSizeChanged = true; | 1353 mUnfocusOnNextSizeChanged = true; |
1354 } else { | 1354 } else { |
1355 undoScrollFocusedEditableNodeIntoViewIfNeeded(false); | 1355 undoScrollFocusedEditableNodeIntoViewIfNeeded(false); |
1356 } | 1356 } |
1357 mImeAdapter.dispatchKeyEventPreIme(event); | |
1358 return mContainerViewInternals.super_dispatchKeyEventPreIme(event); | 1357 return mContainerViewInternals.super_dispatchKeyEventPreIme(event); |
1359 } finally { | 1358 } finally { |
1360 TraceEvent.end(); | 1359 TraceEvent.end(); |
1361 } | 1360 } |
1362 } | 1361 } |
1363 | 1362 |
1364 /** | 1363 /** |
1365 * @see View#dispatchKeyEvent(KeyEvent) | 1364 * @see View#dispatchKeyEvent(KeyEvent) |
1366 */ | 1365 */ |
1367 public boolean dispatchKeyEvent(KeyEvent event) { | 1366 public boolean dispatchKeyEvent(KeyEvent event) { |
1368 if (mImeAdapter != null && | 1367 if (mImeAdapter != null && |
1369 !mImeAdapter.isNativeImeAdapterAttached() && mNativeContentViewC
ore != 0) { | 1368 !mImeAdapter.isNativeImeAdapterAttached() && mNativeContentViewC
ore != 0) { |
1370 mImeAdapter.attach(nativeGetNativeImeAdapter(mNativeContentViewCore)
); | 1369 mImeAdapter.attach(nativeGetNativeImeAdapter(mNativeContentViewCore)
); |
1371 } | 1370 } |
1372 // The key handling logic is kind of confusing here. | 1371 |
1373 // The purpose of shouldOverrideKeyEvent() is to filter out some keys th
at is critical | 1372 if (getContentViewClient().shouldOverrideKeyEvent(event)) { |
1374 // to browser function but useless in renderer process (for example, the
back button), | 1373 return mContainerViewInternals.super_dispatchKeyEvent(event); |
1375 // so the browser can still respond to these keys in a timely manner whe
n the renderer | 1374 } |
1376 // process is busy/blocked/busted. mImeAdapter.dispatchKeyEvent() forwar
ds the key event | 1375 |
1377 // to the renderer process. If mImeAdapter is bypassed or is not interes
ted to the event, | 1376 if (mKeyboardConnected && mImeAdapter.dispatchKeyEvent(event)) return tr
ue; |
1378 // fall back to the default dispatcher to propagate the event to sub-vie
ws. | 1377 |
1379 return (!getContentViewClient().shouldOverrideKeyEvent(event) | 1378 return mContainerViewInternals.super_dispatchKeyEvent(event); |
1380 && mImeAdapter.dispatchKeyEvent(event)) | |
1381 || mContainerViewInternals.super_dispatchKeyEvent(event); | |
1382 } | 1379 } |
1383 | 1380 |
1384 /** | 1381 /** |
1385 * @see View#onHoverEvent(MotionEvent) | 1382 * @see View#onHoverEvent(MotionEvent) |
1386 * Mouse move events are sent on hover enter, hover move and hover exit. | 1383 * Mouse move events are sent on hover enter, hover move and hover exit. |
1387 * They are sent on hover exit because sometimes it acts as both a hover | 1384 * They are sent on hover exit because sometimes it acts as both a hover |
1388 * move and hover exit. | 1385 * move and hover exit. |
1389 */ | 1386 */ |
1390 public boolean onHoverEvent(MotionEvent event) { | 1387 public boolean onHoverEvent(MotionEvent event) { |
1391 TraceEvent.begin("onHoverEvent"); | 1388 TraceEvent.begin("onHoverEvent"); |
(...skipping 1151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2543 private native void nativeUpdateVSyncParameters(int nativeContentViewCoreImp
l, | 2540 private native void nativeUpdateVSyncParameters(int nativeContentViewCoreImp
l, |
2544 long timebaseMicros, long intervalMicros); | 2541 long timebaseMicros, long intervalMicros); |
2545 | 2542 |
2546 private native boolean nativePopulateBitmapFromCompositor(int nativeContentV
iewCoreImpl, | 2543 private native boolean nativePopulateBitmapFromCompositor(int nativeContentV
iewCoreImpl, |
2547 Bitmap bitmap); | 2544 Bitmap bitmap); |
2548 | 2545 |
2549 private native void nativeSetSize(int nativeContentViewCoreImpl, int width,
int height); | 2546 private native void nativeSetSize(int nativeContentViewCoreImpl, int width,
int height); |
2550 | 2547 |
2551 private native boolean nativeIsRenderWidgetHostViewReady(int nativeContentVi
ewCoreImpl); | 2548 private native boolean nativeIsRenderWidgetHostViewReady(int nativeContentVi
ewCoreImpl); |
2552 } | 2549 } |
OLD | NEW |