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.os.Handler; | 8 import android.os.Handler; |
| 8 import android.os.ResultReceiver; | 9 import android.os.ResultReceiver; |
| 9 import android.os.SystemClock; | 10 import android.os.SystemClock; |
| 10 import android.text.Editable; | 11 import android.text.Editable; |
| 11 import android.text.SpannableString; | 12 import android.text.SpannableString; |
| 12 import android.text.style.BackgroundColorSpan; | 13 import android.text.style.BackgroundColorSpan; |
| 13 import android.text.style.CharacterStyle; | 14 import android.text.style.CharacterStyle; |
| 14 import android.text.style.UnderlineSpan; | 15 import android.text.style.UnderlineSpan; |
| 15 import android.view.KeyCharacterMap; | 16 import android.view.KeyCharacterMap; |
| 16 import android.view.KeyEvent; | 17 import android.view.KeyEvent; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 * Called to notify the delegate about synthetic/real key events before sending to renderer. | 58 * Called to notify the delegate about synthetic/real key events before sending to renderer. |
| 58 */ | 59 */ |
| 59 void onImeEvent(); | 60 void onImeEvent(); |
| 60 | 61 |
| 61 /** | 62 /** |
| 62 * Called when a request to hide the keyboard is sent to InputMethodMana ger. | 63 * Called when a request to hide the keyboard is sent to InputMethodMana ger. |
| 63 */ | 64 */ |
| 64 void onDismissInput(); | 65 void onDismissInput(); |
| 65 | 66 |
| 66 /** | 67 /** |
| 68 * Called when the keyboard could not be shown due to the hardware keybo ard being present. | |
| 69 */ | |
| 70 void onKeyboardBoundsUnchanged(); | |
| 71 | |
| 72 /** | |
| 67 * @return View that the keyboard should be attached to. | 73 * @return View that the keyboard should be attached to. |
| 68 */ | 74 */ |
| 69 View getAttachedView(); | 75 View getAttachedView(); |
| 70 | 76 |
| 71 /** | 77 /** |
| 72 * @return Object that should be called for all keyboard show and hide r equests. | 78 * @return Object that should be called for all keyboard show and hide r equests. |
| 73 */ | 79 */ |
| 74 ResultReceiver getNewShowKeyboardReceiver(); | 80 ResultReceiver getNewShowKeyboardReceiver(); |
| 75 } | 81 } |
| 76 | 82 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 * Attaches the imeAdapter to its native counterpart. This is needed to star t forwarding | 287 * Attaches the imeAdapter to its native counterpart. This is needed to star t forwarding |
| 282 * keyboard events to WebKit. | 288 * keyboard events to WebKit. |
| 283 * @param nativeImeAdapter The pointer to the native ImeAdapter object. | 289 * @param nativeImeAdapter The pointer to the native ImeAdapter object. |
| 284 */ | 290 */ |
| 285 public void attach(long nativeImeAdapter) { | 291 public void attach(long nativeImeAdapter) { |
| 286 attach(nativeImeAdapter, TextInputType.NONE, sTextInputFlagNone); | 292 attach(nativeImeAdapter, TextInputType.NONE, sTextInputFlagNone); |
| 287 } | 293 } |
| 288 | 294 |
| 289 private void showKeyboard() { | 295 private void showKeyboard() { |
| 290 mIsShowWithoutHideOutstanding = true; | 296 mIsShowWithoutHideOutstanding = true; |
| 291 mInputMethodManagerWrapper.showSoftInput(mViewEmbedder.getAttachedView() , 0, | 297 if (mViewEmbedder.getAttachedView().getResources().getConfiguration().ke yboard |
| 292 mViewEmbedder.getNewShowKeyboardReceiver()); | 298 == Configuration.KEYBOARD_NOKEYS) { |
|
aurimas (slooooooooow)
2015/01/15 00:50:16
Does KEYBOARD_NOKEYS catch bluetooth keyboards?
please use gerrit instead
2015/01/15 01:09:13
I've tested with a wired USB keyboard only. (I hoo
| |
| 299 mInputMethodManagerWrapper.showSoftInput(mViewEmbedder.getAttachedVi ew(), 0, | |
| 300 mViewEmbedder.getNewShowKeyboardReceiver()); | |
| 301 } else { | |
| 302 mViewEmbedder.onKeyboardBoundsUnchanged(); | |
| 303 } | |
| 293 } | 304 } |
| 294 | 305 |
| 295 private void dismissInput(boolean unzoomIfNeeded) { | 306 private void dismissInput(boolean unzoomIfNeeded) { |
| 296 mIsShowWithoutHideOutstanding = false; | 307 mIsShowWithoutHideOutstanding = false; |
| 297 View view = mViewEmbedder.getAttachedView(); | 308 View view = mViewEmbedder.getAttachedView(); |
| 298 if (mInputMethodManagerWrapper.isActive(view)) { | 309 if (mInputMethodManagerWrapper.isActive(view)) { |
| 299 mInputMethodManagerWrapper.hideSoftInputFromWindow(view.getWindowTok en(), 0, | 310 mInputMethodManagerWrapper.hideSoftInputFromWindow(view.getWindowTok en(), 0, |
| 300 unzoomIfNeeded ? mViewEmbedder.getNewShowKeyboardReceiver() : null); | 311 unzoomIfNeeded ? mViewEmbedder.getNewShowKeyboardReceiver() : null); |
| 301 } | 312 } |
| 302 mViewEmbedder.onDismissInput(); | 313 mViewEmbedder.onDismissInput(); |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 710 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid , | 721 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid , |
| 711 int before, int after); | 722 int before, int after); |
| 712 | 723 |
| 713 private native void nativeUnselect(long nativeImeAdapterAndroid); | 724 private native void nativeUnselect(long nativeImeAdapterAndroid); |
| 714 private native void nativeSelectAll(long nativeImeAdapterAndroid); | 725 private native void nativeSelectAll(long nativeImeAdapterAndroid); |
| 715 private native void nativeCut(long nativeImeAdapterAndroid); | 726 private native void nativeCut(long nativeImeAdapterAndroid); |
| 716 private native void nativeCopy(long nativeImeAdapterAndroid); | 727 private native void nativeCopy(long nativeImeAdapterAndroid); |
| 717 private native void nativePaste(long nativeImeAdapterAndroid); | 728 private native void nativePaste(long nativeImeAdapterAndroid); |
| 718 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); | 729 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); |
| 719 } | 730 } |
| OLD | NEW |