OLD | NEW |
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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 | 167 |
168 rwhi->Send(new ViewMsg_ImeBatchStateChanged(rwhi->GetRoutingID(), is_begin)); | 168 rwhi->Send(new ViewMsg_ImeBatchStateChanged(rwhi->GetRoutingID(), is_begin)); |
169 } | 169 } |
170 | 170 |
171 void ImeAdapterAndroid::CommitText(JNIEnv* env, jobject, jstring text) { | 171 void ImeAdapterAndroid::CommitText(JNIEnv* env, jobject, jstring text) { |
172 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); | 172 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); |
173 if (!rwhi) | 173 if (!rwhi) |
174 return; | 174 return; |
175 | 175 |
176 string16 text16 = ConvertJavaStringToUTF16(env, text); | 176 string16 text16 = ConvertJavaStringToUTF16(env, text); |
177 rwhi->ImeConfirmComposition(text16, ui::Range::InvalidRange(), false); | 177 rwhi->ImeConfirmComposition(text16, gfx::Range::InvalidRange(), false); |
178 } | 178 } |
179 | 179 |
180 void ImeAdapterAndroid::FinishComposingText(JNIEnv* env, jobject) { | 180 void ImeAdapterAndroid::FinishComposingText(JNIEnv* env, jobject) { |
181 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); | 181 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); |
182 if (!rwhi) | 182 if (!rwhi) |
183 return; | 183 return; |
184 | 184 |
185 rwhi->ImeConfirmComposition(string16(), ui::Range::InvalidRange(), true); | 185 rwhi->ImeConfirmComposition(string16(), gfx::Range::InvalidRange(), true); |
186 } | 186 } |
187 | 187 |
188 void ImeAdapterAndroid::AttachImeAdapter(JNIEnv* env, jobject java_object) { | 188 void ImeAdapterAndroid::AttachImeAdapter(JNIEnv* env, jobject java_object) { |
189 java_ime_adapter_ = JavaObjectWeakGlobalRef(env, java_object); | 189 java_ime_adapter_ = JavaObjectWeakGlobalRef(env, java_object); |
190 } | 190 } |
191 | 191 |
192 void ImeAdapterAndroid::CancelComposition() { | 192 void ImeAdapterAndroid::CancelComposition() { |
193 base::android::ScopedJavaLocalRef<jobject> obj = | 193 base::android::ScopedJavaLocalRef<jobject> obj = |
194 java_ime_adapter_.get(AttachCurrentThread()); | 194 java_ime_adapter_.get(AttachCurrentThread()); |
195 if (!obj.is_null()) | 195 if (!obj.is_null()) |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() { | 277 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() { |
278 DCHECK(rwhva_); | 278 DCHECK(rwhva_); |
279 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost(); | 279 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost(); |
280 if (!rwh) | 280 if (!rwh) |
281 return NULL; | 281 return NULL; |
282 | 282 |
283 return RenderWidgetHostImpl::From(rwh); | 283 return RenderWidgetHostImpl::From(rwh); |
284 } | 284 } |
285 | 285 |
286 } // namespace content | 286 } // namespace content |
OLD | NEW |