Chromium Code Reviews| Index: content/public/android/java/src/org/chromium/content/browser/input/ChromiumBaseInputConnection.java |
| diff --git a/content/public/android/java/src/org/chromium/content/browser/input/ChromiumBaseInputConnection.java b/content/public/android/java/src/org/chromium/content/browser/input/ChromiumBaseInputConnection.java |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..40cb6a2f92e8d981c7d4a61b4befb48cdbccaab8 |
| --- /dev/null |
| +++ b/content/public/android/java/src/org/chromium/content/browser/input/ChromiumBaseInputConnection.java |
| @@ -0,0 +1,75 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +package org.chromium.content.browser.input; |
| + |
| +import android.view.KeyEvent; |
| +import android.view.View; |
| +import android.view.inputmethod.EditorInfo; |
| +import android.view.inputmethod.InputConnection; |
| + |
| +import org.chromium.base.VisibleForTesting; |
| + |
| +/** |
| + * An interface to help switch between AdapterInputConnection and ChromiumInputConnection. |
| + */ |
| +public interface ChromiumBaseInputConnection extends InputConnection { |
| + /** |
| + * An interface to help run or post some task on a thread. |
| + */ |
| + 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
|
| + @VisibleForTesting |
| + boolean runningOnThisThread(); |
| + @VisibleForTesting |
| + void post(Runnable runnable); |
| + } |
| + |
| + /** |
| + * A factory class to create or reuse ChromiumBaseInputConnection. |
| + */ |
| + public interface Factory { |
| + ChromiumBaseInputConnection get(View view, ImeAdapter imeAdapter, int inputType, |
| + int inputFlags, EditorInfo outAttrs); |
| + } |
| + |
| + /** |
| + * Updates the internal representation of the text being edited and its selection and |
| + * composition properties. |
| + * |
| + * @param text The String contents of the field being edited. |
| + * @param selectionStart The character offset of the selection start, or the caret position if |
| + * there is no selection. |
| + * @param selectionEnd The character offset of the selection end, or the caret position if there |
| + * is no selection. |
| + * @param compositionStart The character offset of the composition start, or -1 if there is no |
| + * composition. |
| + * @param compositionEnd The character offset of the composition end, or -1 if there is no |
| + * selection. |
| + * @param isNonImeChange True when the update was caused by non-IME (e.g. Javascript). |
| + */ |
| + 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
|
| + int compositionStart, int compositionEnd, boolean singleLine, boolean isNonImeChange); |
| + |
| + /** |
| + * Send key event on UI thread. |
| + * @param event A key event. |
| + */ |
| + boolean sendKeyEventOnUiThread(KeyEvent event); |
| + |
| + /** |
| + * Call this when restartInput() is called. |
| + */ |
| + void onRestartInputOnUiThread(); |
| + |
| + /** |
| + * @return The thread manager for this InputConnection. |
| + */ |
| + @VisibleForTesting |
| + ThreadManager getThreadManager(); |
| + |
| + /** |
| + * Move cursor to the end of the current selection. |
| + */ |
| + void moveCursorToSelectionEndOnUiThread(); |
| +} |