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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 } | 288 } |
289 | 289 |
290 private static boolean isTextInputType(int type) { | 290 private static boolean isTextInputType(int type) { |
291 return type != sTextInputTypeNone && !InputDialogContainer.isDialogInput
Type(type); | 291 return type != sTextInputTypeNone && !InputDialogContainer.isDialogInput
Type(type); |
292 } | 292 } |
293 | 293 |
294 public boolean hasTextInputType() { | 294 public boolean hasTextInputType() { |
295 return isTextInputType(mTextInputType); | 295 return isTextInputType(mTextInputType); |
296 } | 296 } |
297 | 297 |
| 298 /** |
| 299 * @return true if the selected text is of password. |
| 300 */ |
| 301 public boolean isSelectionPassword() { |
| 302 return mTextInputType == sTextInputTypePassword; |
| 303 } |
| 304 |
298 public boolean dispatchKeyEvent(KeyEvent event) { | 305 public boolean dispatchKeyEvent(KeyEvent event) { |
299 return translateAndSendNativeEvents(event); | 306 return translateAndSendNativeEvents(event); |
300 } | 307 } |
301 | 308 |
302 private int shouldSendKeyEventWithKeyCode(String text) { | 309 private int shouldSendKeyEventWithKeyCode(String text) { |
303 if (text.length() != 1) return COMPOSITION_KEY_CODE; | 310 if (text.length() != 1) return COMPOSITION_KEY_CODE; |
304 | 311 |
305 if (text.equals("\n")) return KeyEvent.KEYCODE_ENTER; | 312 if (text.equals("\n")) return KeyEvent.KEYCODE_ENTER; |
306 else if (text.equals("\t")) return KeyEvent.KEYCODE_TAB; | 313 else if (text.equals("\t")) return KeyEvent.KEYCODE_TAB; |
307 else return COMPOSITION_KEY_CODE; | 314 else return COMPOSITION_KEY_CODE; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid
, | 555 private native void nativeDeleteSurroundingText(long nativeImeAdapterAndroid
, |
549 int before, int after); | 556 int before, int after); |
550 | 557 |
551 private native void nativeUnselect(long nativeImeAdapterAndroid); | 558 private native void nativeUnselect(long nativeImeAdapterAndroid); |
552 private native void nativeSelectAll(long nativeImeAdapterAndroid); | 559 private native void nativeSelectAll(long nativeImeAdapterAndroid); |
553 private native void nativeCut(long nativeImeAdapterAndroid); | 560 private native void nativeCut(long nativeImeAdapterAndroid); |
554 private native void nativeCopy(long nativeImeAdapterAndroid); | 561 private native void nativeCopy(long nativeImeAdapterAndroid); |
555 private native void nativePaste(long nativeImeAdapterAndroid); | 562 private native void nativePaste(long nativeImeAdapterAndroid); |
556 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); | 563 private native void nativeResetImeAdapter(long nativeImeAdapterAndroid); |
557 } | 564 } |
OLD | NEW |