Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 package org.chromium.content.browser.input; | |
| 6 | |
| 7 import android.view.KeyEvent; | |
| 8 import android.view.View; | |
| 9 import android.view.inputmethod.EditorInfo; | |
| 10 import android.view.inputmethod.InputConnection; | |
| 11 | |
| 12 import org.chromium.base.VisibleForTesting; | |
| 13 | |
| 14 /** | |
| 15 * An interface to help switch between AdapterInputConnection and ChromiumInputC onnection. | |
| 16 */ | |
| 17 public interface ChromiumBaseInputConnection extends InputConnection { | |
| 18 /** | |
| 19 * An interface to help run or post some task on a thread. | |
| 20 */ | |
| 21 public interface ThreadManager { | |
|
aelias_OOO_until_Jul13
2016/01/21 07:43:04
I suggest renaming this to ImeThread.
Changwan Ryu
2016/01/22 10:22:16
Hmm... This is also used for ReplicaInputConnectio
| |
| 22 @VisibleForTesting | |
| 23 boolean runningOnThisThread(); | |
| 24 @VisibleForTesting | |
| 25 void post(Runnable runnable); | |
| 26 } | |
| 27 | |
| 28 /** | |
| 29 * A factory class to create or reuse ChromiumBaseInputConnection. | |
| 30 */ | |
| 31 public interface Factory { | |
| 32 ChromiumBaseInputConnection get(View view, ImeAdapter imeAdapter, int in putType, | |
| 33 int inputFlags, EditorInfo outAttrs); | |
| 34 } | |
| 35 | |
| 36 /** | |
| 37 * Updates the internal representation of the text being edited and its sele ction and | |
| 38 * composition properties. | |
| 39 * | |
| 40 * @param text The String contents of the field being edited. | |
| 41 * @param selectionStart The character offset of the selection start, or the caret position if | |
| 42 * there is no selection. | |
| 43 * @param selectionEnd The character offset of the selection end, or the car et position if there | |
| 44 * is no selection. | |
| 45 * @param compositionStart The character offset of the composition start, or -1 if there is no | |
| 46 * composition. | |
| 47 * @param compositionEnd The character offset of the composition end, or -1 if there is no | |
| 48 * selection. | |
| 49 * @param isNonImeChange True when the update was caused by non-IME (e.g. Ja vascript). | |
| 50 */ | |
| 51 void updateStateOnUiThread(String text, int selectionStart, int selectionEnd , | |
|
aelias_OOO_until_Jul13
2016/01/21 07:43:04
How about making this "void updateStateOnUiThread(
Changwan Ryu
2016/01/22 10:22:16
Hmm... I prefer not to change ReplicaInputConnecti
| |
| 52 int compositionStart, int compositionEnd, boolean singleLine, boolea n isNonImeChange); | |
| 53 | |
| 54 /** | |
| 55 * Send key event on UI thread. | |
| 56 * @param event A key event. | |
| 57 */ | |
| 58 boolean sendKeyEventOnUiThread(KeyEvent event); | |
| 59 | |
| 60 /** | |
| 61 * Call this when restartInput() is called. | |
| 62 */ | |
| 63 void onRestartInputOnUiThread(); | |
| 64 | |
| 65 /** | |
| 66 * @return The thread manager for this InputConnection. | |
| 67 */ | |
| 68 @VisibleForTesting | |
| 69 ThreadManager getThreadManager(); | |
| 70 | |
| 71 /** | |
| 72 * Move cursor to the end of the current selection. | |
| 73 */ | |
| 74 void moveCursorToSelectionEndOnUiThread(); | |
| 75 } | |
| OLD | NEW |