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

Side by Side Diff: content/browser/renderer_host/ime_adapter_android.cc

Issue 24195023: Switch to sending IME selection updates early. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ted's nits Created 7 years, 2 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 | Annotate | Revision Log
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 #include "content/browser/renderer_host/ime_adapter_android.h" 5 #include "content/browser/renderer_host/ime_adapter_android.h"
6 6
7 #include <android/input.h> 7 #include <android/input.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_string.h" 10 #include "base/android/jni_string.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 false)); 151 false));
152 // new_cursor_position is as described in the Android API for 152 // new_cursor_position is as described in the Android API for
153 // InputConnection#setComposingText, whereas the parameters for 153 // InputConnection#setComposingText, whereas the parameters for
154 // ImeSetComposition are relative to the start of the composition. 154 // ImeSetComposition are relative to the start of the composition.
155 if (new_cursor_pos > 0) 155 if (new_cursor_pos > 0)
156 new_cursor_pos = text16.length() + new_cursor_pos - 1; 156 new_cursor_pos = text16.length() + new_cursor_pos - 1;
157 157
158 rwhi->ImeSetComposition(text16, underlines, new_cursor_pos, new_cursor_pos); 158 rwhi->ImeSetComposition(text16, underlines, new_cursor_pos, new_cursor_pos);
159 } 159 }
160 160
161 void ImeAdapterAndroid::ImeBatchStateChanged(JNIEnv* env,
162 jobject,
163 jboolean is_begin) {
164 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl();
165 if (!rwhi)
166 return;
167
168 rwhi->Send(new ViewMsg_ImeBatchStateChanged(rwhi->GetRoutingID(), is_begin));
169 }
170
171 void ImeAdapterAndroid::CommitText(JNIEnv* env, jobject, jstring text) { 161 void ImeAdapterAndroid::CommitText(JNIEnv* env, jobject, jstring text) {
172 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); 162 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl();
173 if (!rwhi) 163 if (!rwhi)
174 return; 164 return;
175 165
176 string16 text16 = ConvertJavaStringToUTF16(env, text); 166 string16 text16 = ConvertJavaStringToUTF16(env, text);
177 rwhi->ImeConfirmComposition(text16, gfx::Range::InvalidRange(), false); 167 rwhi->ImeConfirmComposition(text16, gfx::Range::InvalidRange(), false);
178 } 168 }
179 169
180 void ImeAdapterAndroid::FinishComposingText(JNIEnv* env, jobject) { 170 void ImeAdapterAndroid::FinishComposingText(JNIEnv* env, jobject) {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() { 267 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() {
278 DCHECK(rwhva_); 268 DCHECK(rwhva_);
279 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost(); 269 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost();
280 if (!rwh) 270 if (!rwh)
281 return NULL; 271 return NULL;
282 272
283 return RenderWidgetHostImpl::From(rwh); 273 return RenderWidgetHostImpl::From(rwh);
284 } 274 }
285 275
286 } // namespace content 276 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/ime_adapter_android.h ('k') | content/browser/renderer_host/render_widget_host_view_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698