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.os.Handler; | 7 import android.os.Handler; |
8 import android.os.ResultReceiver; | 8 import android.os.ResultReceiver; |
9 import android.os.SystemClock; | 9 import android.os.SystemClock; |
10 import android.text.Editable; | 10 import android.text.Editable; |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 | 243 |
244 public void attach(long nativeImeAdapter, int textInputType) { | 244 public void attach(long nativeImeAdapter, int textInputType) { |
245 if (mNativeImeAdapterAndroid != 0) { | 245 if (mNativeImeAdapterAndroid != 0) { |
246 nativeResetImeAdapter(mNativeImeAdapterAndroid); | 246 nativeResetImeAdapter(mNativeImeAdapterAndroid); |
247 } | 247 } |
248 mNativeImeAdapterAndroid = nativeImeAdapter; | 248 mNativeImeAdapterAndroid = nativeImeAdapter; |
249 mTextInputType = textInputType; | 249 mTextInputType = textInputType; |
250 if (nativeImeAdapter != 0) { | 250 if (nativeImeAdapter != 0) { |
251 nativeAttachImeAdapter(mNativeImeAdapterAndroid); | 251 nativeAttachImeAdapter(mNativeImeAdapterAndroid); |
252 } | 252 } |
| 253 if (mTextInputType == sTextInputTypeNone) { |
| 254 dismissInput(false); |
| 255 } |
253 } | 256 } |
254 | 257 |
255 /** | 258 /** |
256 * Attaches the imeAdapter to its native counterpart. This is needed to star
t forwarding | 259 * Attaches the imeAdapter to its native counterpart. This is needed to star
t forwarding |
257 * keyboard events to WebKit. | 260 * keyboard events to WebKit. |
258 * @param nativeImeAdapter The pointer to the native ImeAdapter object. | 261 * @param nativeImeAdapter The pointer to the native ImeAdapter object. |
259 */ | 262 */ |
260 public void attach(long nativeImeAdapter) { | 263 public void attach(long nativeImeAdapter) { |
261 if (mNativeImeAdapterAndroid != 0) { | 264 attach(nativeImeAdapter, sTextInputTypeNone); |
262 nativeResetImeAdapter(mNativeImeAdapterAndroid); | |
263 } | |
264 mNativeImeAdapterAndroid = nativeImeAdapter; | |
265 if (nativeImeAdapter != 0) { | |
266 nativeAttachImeAdapter(mNativeImeAdapterAndroid); | |
267 } | |
268 } | 265 } |
269 | 266 |
270 private void showKeyboard() { | 267 private void showKeyboard() { |
271 mIsShowWithoutHideOutstanding = true; | 268 mIsShowWithoutHideOutstanding = true; |
272 mInputMethodManagerWrapper.showSoftInput(mViewEmbedder.getAttachedView()
, 0, | 269 mInputMethodManagerWrapper.showSoftInput(mViewEmbedder.getAttachedView()
, 0, |
273 mViewEmbedder.getNewShowKeyboardReceiver()); | 270 mViewEmbedder.getNewShowKeyboardReceiver()); |
274 } | 271 } |
275 | 272 |
276 private void dismissInput(boolean unzoomIfNeeded) { | 273 private void dismissInput(boolean unzoomIfNeeded) { |
277 mIsShowWithoutHideOutstanding = false; | 274 mIsShowWithoutHideOutstanding = false; |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid
, | 552 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid
, |
556 int before, int after); | 553 int before, int after); |
557 | 554 |
558 private native void nativeUnselect(long nativeImeAdapterAndroid); | 555 private native void nativeUnselect(long nativeImeAdapterAndroid); |
559 private native void nativeSelectAll(long nativeImeAdapterAndroid); | 556 private native void nativeSelectAll(long nativeImeAdapterAndroid); |
560 private native void nativeCut(long nativeImeAdapterAndroid); | 557 private native void nativeCut(long nativeImeAdapterAndroid); |
561 private native void nativeCopy(long nativeImeAdapterAndroid); | 558 private native void nativeCopy(long nativeImeAdapterAndroid); |
562 private native void nativePaste(long nativeImeAdapterAndroid); | 559 private native void nativePaste(long nativeImeAdapterAndroid); |
563 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); | 560 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); |
564 } | 561 } |
OLD | NEW |