| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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.content.res.Configuration; | 7 import android.content.res.Configuration; |
| 8 import android.os.Build; | 8 import android.os.Build; |
| 9 import android.os.ResultReceiver; | 9 import android.os.ResultReceiver; |
| 10 import android.os.SystemClock; | 10 import android.os.SystemClock; |
| (...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE)
; | 559 KeyEvent.FLAG_SOFT_KEYBOARD | KeyEvent.FLAG_KEEP_TOUCH_MODE)
; |
| 560 return true; | 560 return true; |
| 561 } | 561 } |
| 562 | 562 |
| 563 mViewEmbedder.onImeEvent(); | 563 mViewEmbedder.onImeEvent(); |
| 564 long timestampMs = SystemClock.uptimeMillis(); | 564 long timestampMs = SystemClock.uptimeMillis(); |
| 565 nativeSendKeyEvent(mNativeImeAdapterAndroid, null, WebInputEventType.Raw
KeyDown, 0, | 565 nativeSendKeyEvent(mNativeImeAdapterAndroid, null, WebInputEventType.Raw
KeyDown, 0, |
| 566 timestampMs, COMPOSITION_KEY_CODE, 0, false, unicodeFromKeyEvent
); | 566 timestampMs, COMPOSITION_KEY_CODE, 0, false, unicodeFromKeyEvent
); |
| 567 | 567 |
| 568 if (isCommit) { | 568 if (isCommit) { |
| 569 nativeCommitText(mNativeImeAdapterAndroid, text.toString()); | 569 nativeCommitText(mNativeImeAdapterAndroid, text.toString(), newCurso
rPosition); |
| 570 } else { | 570 } else { |
| 571 nativeSetComposingText( | 571 nativeSetComposingText( |
| 572 mNativeImeAdapterAndroid, text, text.toString(), newCursorPo
sition); | 572 mNativeImeAdapterAndroid, text, text.toString(), newCursorPo
sition); |
| 573 } | 573 } |
| 574 | 574 |
| 575 nativeSendKeyEvent(mNativeImeAdapterAndroid, null, WebInputEventType.Key
Up, 0, timestampMs, | 575 nativeSendKeyEvent(mNativeImeAdapterAndroid, null, WebInputEventType.Key
Up, 0, timestampMs, |
| 576 COMPOSITION_KEY_CODE, 0, false, unicodeFromKeyEvent); | 576 COMPOSITION_KEY_CODE, 0, false, unicodeFromKeyEvent); |
| 577 return true; | 577 return true; |
| 578 } | 578 } |
| 579 | 579 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 } | 761 } |
| 762 | 762 |
| 763 private native boolean nativeSendKeyEvent(long nativeImeAdapterAndroid, KeyE
vent event, | 763 private native boolean nativeSendKeyEvent(long nativeImeAdapterAndroid, KeyE
vent event, |
| 764 int type, int modifiers, long timestampMs, int keyCode, int scanCode
, | 764 int type, int modifiers, long timestampMs, int keyCode, int scanCode
, |
| 765 boolean isSystemKey, int unicodeChar); | 765 boolean isSystemKey, int unicodeChar); |
| 766 private static native void nativeAppendUnderlineSpan(long underlinePtr, int
start, int end); | 766 private static native void nativeAppendUnderlineSpan(long underlinePtr, int
start, int end); |
| 767 private static native void nativeAppendBackgroundColorSpan(long underlinePtr
, int start, | 767 private static native void nativeAppendBackgroundColorSpan(long underlinePtr
, int start, |
| 768 int end, int backgroundColor); | 768 int end, int backgroundColor); |
| 769 private native void nativeSetComposingText(long nativeImeAdapterAndroid, Cha
rSequence text, | 769 private native void nativeSetComposingText(long nativeImeAdapterAndroid, Cha
rSequence text, |
| 770 String textStr, int newCursorPosition); | 770 String textStr, int newCursorPosition); |
| 771 private native void nativeCommitText(long nativeImeAdapterAndroid, String te
xtStr); | 771 private native void nativeCommitText( |
| 772 long nativeImeAdapterAndroid, String textStr, int newCursorPosition)
; |
| 772 private native void nativeFinishComposingText(long nativeImeAdapterAndroid); | 773 private native void nativeFinishComposingText(long nativeImeAdapterAndroid); |
| 773 private native void nativeAttachImeAdapter(long nativeImeAdapterAndroid); | 774 private native void nativeAttachImeAdapter(long nativeImeAdapterAndroid); |
| 774 private native void nativeSetEditableSelectionOffsets(long nativeImeAdapterA
ndroid, | 775 private native void nativeSetEditableSelectionOffsets(long nativeImeAdapterA
ndroid, |
| 775 int start, int end); | 776 int start, int end); |
| 776 private native void nativeSetComposingRegion(long nativeImeAdapterAndroid, i
nt start, int end); | 777 private native void nativeSetComposingRegion(long nativeImeAdapterAndroid, i
nt start, int end); |
| 777 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid
, | 778 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid
, |
| 778 int before, int after); | 779 int before, int after); |
| 779 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); | 780 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); |
| 780 private native boolean nativeRequestTextInputStateUpdate(long nativeImeAdapt
erAndroid); | 781 private native boolean nativeRequestTextInputStateUpdate(long nativeImeAdapt
erAndroid); |
| 781 private native void nativeRequestCursorUpdate(long nativeImeAdapterAndroid, | 782 private native void nativeRequestCursorUpdate(long nativeImeAdapterAndroid, |
| 782 boolean immediateRequest, boolean monitorRequest); | 783 boolean immediateRequest, boolean monitorRequest); |
| 783 private native boolean nativeIsImeThreadEnabled(long nativeImeAdapterAndroid
); | 784 private native boolean nativeIsImeThreadEnabled(long nativeImeAdapterAndroid
); |
| 784 } | 785 } |
| OLD | NEW |