Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: content/public/android/java/src/org/chromium/content/browser/input/ImeAdapter.java

Issue 14129003: Fix the incorrect native ImeAdapter attach and detach. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: fix nits Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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.Context; 7 import android.content.Context;
8 import android.os.Handler; 8 import android.os.Handler;
9 import android.os.ResultReceiver; 9 import android.os.ResultReceiver;
10 import android.view.KeyCharacterMap; 10 import android.view.KeyCharacterMap;
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 if (showIfNeeded) { 246 if (showIfNeeded) {
247 showKeyboard(); 247 showKeyboard();
248 } 248 }
249 } else if (hasInputType() && showIfNeeded) { 249 } else if (hasInputType() && showIfNeeded) {
250 showKeyboard(); 250 showKeyboard();
251 } 251 }
252 } 252 }
253 253
254 public void attach(int nativeImeAdapter, int textInputType, int selectionSta rt, 254 public void attach(int nativeImeAdapter, int textInputType, int selectionSta rt,
255 int selectionEnd) { 255 int selectionEnd) {
256 if (mNativeImeAdapterAndroid != 0) {
257 nativeResetImeAdapter(mNativeImeAdapterAndroid);
258 }
256 mNativeImeAdapterAndroid = nativeImeAdapter; 259 mNativeImeAdapterAndroid = nativeImeAdapter;
257 mTextInputType = textInputType; 260 mTextInputType = textInputType;
258 mInitialSelectionStart = selectionStart; 261 mInitialSelectionStart = selectionStart;
259 mInitialSelectionEnd = selectionEnd; 262 mInitialSelectionEnd = selectionEnd;
260 nativeAttachImeAdapter(mNativeImeAdapterAndroid); 263 nativeAttachImeAdapter(mNativeImeAdapterAndroid);
261 } 264 }
262 265
263 /** 266 /**
264 * Attaches the imeAdapter to its native counterpart. This is needed to star t forwarding 267 * Attaches the imeAdapter to its native counterpart. This is needed to star t forwarding
265 * keyboard events to WebKit. 268 * keyboard events to WebKit.
266 * @param nativeImeAdapter The pointer to the native ImeAdapter object. 269 * @param nativeImeAdapter The pointer to the native ImeAdapter object.
267 */ 270 */
268 public void attach(int nativeImeAdapter) { 271 public void attach(int nativeImeAdapter) {
272 if (mNativeImeAdapterAndroid != 0) {
273 nativeResetImeAdapter(mNativeImeAdapterAndroid);
274 }
269 mNativeImeAdapterAndroid = nativeImeAdapter; 275 mNativeImeAdapterAndroid = nativeImeAdapter;
270 if (nativeImeAdapter != 0) { 276 if (nativeImeAdapter != 0) {
271 nativeAttachImeAdapter(mNativeImeAdapterAndroid); 277 nativeAttachImeAdapter(mNativeImeAdapterAndroid);
272 } 278 }
273 } 279 }
274 280
275 /** 281 /**
276 * Used to check whether the native counterpart of the ImeAdapter has been a ttached yet. 282 * Used to check whether the native counterpart of the ImeAdapter has been a ttached yet.
277 * @return Whether native ImeAdapter has been attached and its pointer is cu rrently nonzero. 283 * @return Whether native ImeAdapter has been attached and its pointer is cu rrently nonzero.
278 */ 284 */
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 private native void nativeDeleteSurroundingText(int nativeImeAdapterAndroid, 568 private native void nativeDeleteSurroundingText(int nativeImeAdapterAndroid,
563 int before, int after); 569 int before, int after);
564 570
565 private native void nativeImeBatchStateChanged(int nativeImeAdapterAndroid, boolean isBegin); 571 private native void nativeImeBatchStateChanged(int nativeImeAdapterAndroid, boolean isBegin);
566 572
567 private native void nativeUnselect(int nativeImeAdapterAndroid); 573 private native void nativeUnselect(int nativeImeAdapterAndroid);
568 private native void nativeSelectAll(int nativeImeAdapterAndroid); 574 private native void nativeSelectAll(int nativeImeAdapterAndroid);
569 private native void nativeCut(int nativeImeAdapterAndroid); 575 private native void nativeCut(int nativeImeAdapterAndroid);
570 private native void nativeCopy(int nativeImeAdapterAndroid); 576 private native void nativeCopy(int nativeImeAdapterAndroid);
571 private native void nativePaste(int nativeImeAdapterAndroid); 577 private native void nativePaste(int nativeImeAdapterAndroid);
578 private native void nativeResetImeAdapter(int nativeImeAdapterAndroid);
572 } 579 }
OLDNEW
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698