Chromium Code Reviews| 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 186 setInputConnection(null); | 186 setInputConnection(null); |
| 187 if (DEBUG_LOGS) Log.w(TAG, "onCreateInputConnection returns null."); | 187 if (DEBUG_LOGS) Log.w(TAG, "onCreateInputConnection returns null."); |
| 188 return null; | 188 return null; |
| 189 } | 189 } |
| 190 if (mInputConnectionFactory == null) return null; | 190 if (mInputConnectionFactory == null) return null; |
| 191 setInputConnection(mInputConnectionFactory.initializeAndGet( | 191 setInputConnection(mInputConnectionFactory.initializeAndGet( |
| 192 mViewEmbedder.getAttachedView(), this, mTextInputType, mTextInpu tFlags, | 192 mViewEmbedder.getAttachedView(), this, mTextInputType, mTextInpu tFlags, |
| 193 mLastSelectionStart, mLastSelectionEnd, outAttrs)); | 193 mLastSelectionStart, mLastSelectionEnd, outAttrs)); |
| 194 if (DEBUG_LOGS) Log.w(TAG, "onCreateInputConnection: " + mInputConnectio n); | 194 if (DEBUG_LOGS) Log.w(TAG, "onCreateInputConnection: " + mInputConnectio n); |
| 195 if (mCursorAnchorInfoController != null) { | 195 if (mCursorAnchorInfoController != null) { |
| 196 mCursorAnchorInfoController.resetMonitoringState(); | 196 onRequestCursorUpdates(0 /* disable any cursor update */); |
|
yosin_UTC9
2016/07/06 02:02:01
How about
const int kDisableAnyCursorUpdate = 0;
o
Seigo Nonaka
2016/07/06 03:25:56
Done.
| |
| 197 } | 197 } |
| 198 return mInputConnection; | 198 return mInputConnection; |
| 199 } | 199 } |
| 200 | 200 |
| 201 private void setInputConnection(ChromiumBaseInputConnection inputConnection) { | 201 private void setInputConnection(ChromiumBaseInputConnection inputConnection) { |
| 202 if (mInputConnection == inputConnection) return; | 202 if (mInputConnection == inputConnection) return; |
| 203 // The previous input connection might be waiting for state update. | 203 // The previous input connection might be waiting for state update. |
| 204 if (mInputConnection != null) mInputConnection.unblockOnUiThread(); | 204 if (mInputConnection != null) mInputConnection.unblockOnUiThread(); |
| 205 mInputConnection = inputConnection; | 205 mInputConnection = inputConnection; |
| 206 } | 206 } |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 654 if (mNativeImeAdapterAndroid == 0) return false; | 654 if (mNativeImeAdapterAndroid == 0) return false; |
| 655 // You won't get state update anyways. | 655 // You won't get state update anyways. |
| 656 if (mInputConnection == null) return false; | 656 if (mInputConnection == null) return false; |
| 657 return nativeRequestTextInputStateUpdate(mNativeImeAdapterAndroid); | 657 return nativeRequestTextInputStateUpdate(mNativeImeAdapterAndroid); |
| 658 } | 658 } |
| 659 | 659 |
| 660 /** | 660 /** |
| 661 * Notified when IME requested Chrome to change the cursor update mode. | 661 * Notified when IME requested Chrome to change the cursor update mode. |
| 662 */ | 662 */ |
| 663 public boolean onRequestCursorUpdates(int cursorUpdateMode) { | 663 public boolean onRequestCursorUpdates(int cursorUpdateMode) { |
| 664 if (mNativeImeAdapterAndroid != 0) { | |
|
yosin_UTC9
2016/07/06 02:02:01
nit: Not need to have curly bracket.
Seigo Nonaka
2016/07/06 03:25:56
Thanks, but presubmit warns if I removed curly bra
| |
| 665 nativeRequestCursorUpdate(mNativeImeAdapterAndroid, cursorUpdateMode ); | |
| 666 } | |
| 664 if (mCursorAnchorInfoController == null) return false; | 667 if (mCursorAnchorInfoController == null) return false; |
| 665 return mCursorAnchorInfoController.onRequestCursorUpdates(cursorUpdateMo de, | 668 return mCursorAnchorInfoController.onRequestCursorUpdates(cursorUpdateMo de, |
| 666 mViewEmbedder.getAttachedView()); | 669 mViewEmbedder.getAttachedView()); |
| 667 } | 670 } |
| 668 | 671 |
| 669 /** | 672 /** |
| 670 * Notified when a frame has been produced by the renderer and all the assoc iated metadata. | 673 * Notified when a frame has been produced by the renderer and all the assoc iated metadata. |
| 671 * @param renderCoordinates coordinate information to convert CSS (document) coordinates to | 674 * @param renderCoordinates coordinate information to convert CSS (document) coordinates to |
| 672 * View-local Physical (screen) coordinates | 675 * View-local Physical (screen) coordinates |
| 673 * @param hasInsertionMarker Whether the insertion marker is visible or not. | 676 * @param hasInsertionMarker Whether the insertion marker is visible or not. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 743 private native void nativeCommitText(long nativeImeAdapterAndroid, String te xtStr); | 746 private native void nativeCommitText(long nativeImeAdapterAndroid, String te xtStr); |
| 744 private native void nativeFinishComposingText(long nativeImeAdapterAndroid); | 747 private native void nativeFinishComposingText(long nativeImeAdapterAndroid); |
| 745 private native void nativeAttachImeAdapter(long nativeImeAdapterAndroid); | 748 private native void nativeAttachImeAdapter(long nativeImeAdapterAndroid); |
| 746 private native void nativeSetEditableSelectionOffsets(long nativeImeAdapterA ndroid, | 749 private native void nativeSetEditableSelectionOffsets(long nativeImeAdapterA ndroid, |
| 747 int start, int end); | 750 int start, int end); |
| 748 private native void nativeSetComposingRegion(long nativeImeAdapterAndroid, i nt start, int end); | 751 private native void nativeSetComposingRegion(long nativeImeAdapterAndroid, i nt start, int end); |
| 749 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid , | 752 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid , |
| 750 int before, int after); | 753 int before, int after); |
| 751 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); | 754 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); |
| 752 private native boolean nativeRequestTextInputStateUpdate(long nativeImeAdapt erAndroid); | 755 private native boolean nativeRequestTextInputStateUpdate(long nativeImeAdapt erAndroid); |
| 756 private native void nativeRequestCursorUpdate(long nativeImeAdapterAndroid, int mode); | |
| 753 private native boolean nativeIsImeThreadEnabled(long nativeImeAdapterAndroid ); | 757 private native boolean nativeIsImeThreadEnabled(long nativeImeAdapterAndroid ); |
| 754 } | 758 } |
| OLD | NEW |