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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 * Called to notify the delegate about synthetic/real key events before
sending to renderer. | 61 * Called to notify the delegate about synthetic/real key events before
sending to renderer. |
61 */ | 62 */ |
62 void onImeEvent(); | 63 void onImeEvent(); |
63 | 64 |
64 /** | 65 /** |
65 * Called when a request to hide the keyboard is sent to InputMethodMana
ger. | 66 * Called when a request to hide the keyboard is sent to InputMethodMana
ger. |
66 */ | 67 */ |
67 void onDismissInput(); | 68 void onDismissInput(); |
68 | 69 |
69 /** | 70 /** |
| 71 * Called when the keyboard could not be shown due to the hardware keybo
ard being present. |
| 72 */ |
| 73 void onKeyboardBoundsUnchanged(); |
| 74 |
| 75 /** |
70 * @return View that the keyboard should be attached to. | 76 * @return View that the keyboard should be attached to. |
71 */ | 77 */ |
72 View getAttachedView(); | 78 View getAttachedView(); |
73 | 79 |
74 /** | 80 /** |
75 * @return Object that should be called for all keyboard show and hide r
equests. | 81 * @return Object that should be called for all keyboard show and hide r
equests. |
76 */ | 82 */ |
77 ResultReceiver getNewShowKeyboardReceiver(); | 83 ResultReceiver getNewShowKeyboardReceiver(); |
78 } | 84 } |
79 | 85 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 * Attaches the imeAdapter to its native counterpart. This is needed to star
t forwarding | 273 * Attaches the imeAdapter to its native counterpart. This is needed to star
t forwarding |
268 * keyboard events to WebKit. | 274 * keyboard events to WebKit. |
269 * @param nativeImeAdapter The pointer to the native ImeAdapter object. | 275 * @param nativeImeAdapter The pointer to the native ImeAdapter object. |
270 */ | 276 */ |
271 public void attach(long nativeImeAdapter) { | 277 public void attach(long nativeImeAdapter) { |
272 attach(nativeImeAdapter, TextInputType.NONE, WebTextInputFlags.None); | 278 attach(nativeImeAdapter, TextInputType.NONE, WebTextInputFlags.None); |
273 } | 279 } |
274 | 280 |
275 private void showKeyboard() { | 281 private void showKeyboard() { |
276 mIsShowWithoutHideOutstanding = true; | 282 mIsShowWithoutHideOutstanding = true; |
277 mInputMethodManagerWrapper.showSoftInput(mViewEmbedder.getAttachedView()
, 0, | 283 if (mViewEmbedder.getAttachedView().getResources().getConfiguration().ke
yboard |
278 mViewEmbedder.getNewShowKeyboardReceiver()); | 284 == Configuration.KEYBOARD_NOKEYS) { |
| 285 mInputMethodManagerWrapper.showSoftInput(mViewEmbedder.getAttachedVi
ew(), 0, |
| 286 mViewEmbedder.getNewShowKeyboardReceiver()); |
| 287 } else { |
| 288 mViewEmbedder.onKeyboardBoundsUnchanged(); |
| 289 } |
279 } | 290 } |
280 | 291 |
281 private void dismissInput(boolean unzoomIfNeeded) { | 292 private void dismissInput(boolean unzoomIfNeeded) { |
282 mIsShowWithoutHideOutstanding = false; | 293 mIsShowWithoutHideOutstanding = false; |
283 View view = mViewEmbedder.getAttachedView(); | 294 View view = mViewEmbedder.getAttachedView(); |
284 if (mInputMethodManagerWrapper.isActive(view)) { | 295 if (mInputMethodManagerWrapper.isActive(view)) { |
285 mInputMethodManagerWrapper.hideSoftInputFromWindow(view.getWindowTok
en(), 0, | 296 mInputMethodManagerWrapper.hideSoftInputFromWindow(view.getWindowTok
en(), 0, |
286 unzoomIfNeeded ? mViewEmbedder.getNewShowKeyboardReceiver()
: null); | 297 unzoomIfNeeded ? mViewEmbedder.getNewShowKeyboardReceiver()
: null); |
287 } | 298 } |
288 mViewEmbedder.onDismissInput(); | 299 mViewEmbedder.onDismissInput(); |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
676 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid
, | 687 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid
, |
677 int before, int after); | 688 int before, int after); |
678 | 689 |
679 private native void nativeUnselect(long nativeImeAdapterAndroid); | 690 private native void nativeUnselect(long nativeImeAdapterAndroid); |
680 private native void nativeSelectAll(long nativeImeAdapterAndroid); | 691 private native void nativeSelectAll(long nativeImeAdapterAndroid); |
681 private native void nativeCut(long nativeImeAdapterAndroid); | 692 private native void nativeCut(long nativeImeAdapterAndroid); |
682 private native void nativeCopy(long nativeImeAdapterAndroid); | 693 private native void nativeCopy(long nativeImeAdapterAndroid); |
683 private native void nativePaste(long nativeImeAdapterAndroid); | 694 private native void nativePaste(long nativeImeAdapterAndroid); |
684 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); | 695 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); |
685 } | 696 } |
OLD | NEW |