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.input; | 5 package org.chromium.content.browser.input; |
6 | 6 |
7 import android.os.Handler; | 7 import android.os.Handler; |
8 import android.os.ResultReceiver; | 8 import android.os.ResultReceiver; |
9 import android.view.KeyCharacterMap; | 9 import android.view.KeyCharacterMap; |
10 import android.view.KeyEvent; | 10 import android.view.KeyEvent; |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 nativeSetComposingText(mNativeImeAdapterAndroid, text, newCursor
Position); | 355 nativeSetComposingText(mNativeImeAdapterAndroid, text, newCursor
Position); |
356 } | 356 } |
357 nativeSendSyntheticKeyEvent(mNativeImeAdapterAndroid, sEventTypeKeyU
p, | 357 nativeSendSyntheticKeyEvent(mNativeImeAdapterAndroid, sEventTypeKeyU
p, |
358 timeStampMs, keyCode, 0); | 358 timeStampMs, keyCode, 0); |
359 } | 359 } |
360 | 360 |
361 return true; | 361 return true; |
362 } | 362 } |
363 | 363 |
364 void finishComposingText() { | 364 void finishComposingText() { |
| 365 if (mNativeImeAdapterAndroid == 0) return; |
365 nativeFinishComposingText(mNativeImeAdapterAndroid); | 366 nativeFinishComposingText(mNativeImeAdapterAndroid); |
366 } | 367 } |
367 | 368 |
368 boolean translateAndSendNativeEvents(KeyEvent event) { | 369 boolean translateAndSendNativeEvents(KeyEvent event) { |
369 if (mNativeImeAdapterAndroid == 0) return false; | 370 if (mNativeImeAdapterAndroid == 0) return false; |
370 | 371 |
371 int action = event.getAction(); | 372 int action = event.getAction(); |
372 if (action != KeyEvent.ACTION_DOWN && | 373 if (action != KeyEvent.ACTION_DOWN && |
373 action != KeyEvent.ACTION_UP) { | 374 action != KeyEvent.ACTION_UP) { |
374 // action == KeyEvent.ACTION_MULTIPLE | 375 // action == KeyEvent.ACTION_MULTIPLE |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 | 561 |
561 private native void nativeImeBatchStateChanged(int nativeImeAdapterAndroid,
boolean isBegin); | 562 private native void nativeImeBatchStateChanged(int nativeImeAdapterAndroid,
boolean isBegin); |
562 | 563 |
563 private native void nativeUnselect(int nativeImeAdapterAndroid); | 564 private native void nativeUnselect(int nativeImeAdapterAndroid); |
564 private native void nativeSelectAll(int nativeImeAdapterAndroid); | 565 private native void nativeSelectAll(int nativeImeAdapterAndroid); |
565 private native void nativeCut(int nativeImeAdapterAndroid); | 566 private native void nativeCut(int nativeImeAdapterAndroid); |
566 private native void nativeCopy(int nativeImeAdapterAndroid); | 567 private native void nativeCopy(int nativeImeAdapterAndroid); |
567 private native void nativePaste(int nativeImeAdapterAndroid); | 568 private native void nativePaste(int nativeImeAdapterAndroid); |
568 private native void nativeResetImeAdapter(int nativeImeAdapterAndroid); | 569 private native void nativeResetImeAdapter(int nativeImeAdapterAndroid); |
569 } | 570 } |
OLD | NEW |