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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 java_ime_adapter_ = JavaObjectWeakGlobalRef(env, java_object); | 172 java_ime_adapter_ = JavaObjectWeakGlobalRef(env, java_object); |
173 } | 173 } |
174 | 174 |
175 void ImeAdapterAndroid::CancelComposition() { | 175 void ImeAdapterAndroid::CancelComposition() { |
176 base::android::ScopedJavaLocalRef<jobject> obj = | 176 base::android::ScopedJavaLocalRef<jobject> obj = |
177 java_ime_adapter_.get(AttachCurrentThread()); | 177 java_ime_adapter_.get(AttachCurrentThread()); |
178 if (!obj.is_null()) | 178 if (!obj.is_null()) |
179 Java_ImeAdapter_cancelComposition(AttachCurrentThread(), obj.obj()); | 179 Java_ImeAdapter_cancelComposition(AttachCurrentThread(), obj.obj()); |
180 } | 180 } |
181 | 181 |
| 182 void ImeAdapterAndroid::FocusedNodeChanged(bool is_editable_node) { |
| 183 base::android::ScopedJavaLocalRef<jobject> obj = |
| 184 java_ime_adapter_.get(AttachCurrentThread()); |
| 185 if (!obj.is_null()) { |
| 186 Java_ImeAdapter_focusedNodeChanged(AttachCurrentThread(), |
| 187 obj.obj(), |
| 188 is_editable_node); |
| 189 } |
| 190 } |
| 191 |
182 void ImeAdapterAndroid::SetEditableSelectionOffsets(JNIEnv*, jobject, | 192 void ImeAdapterAndroid::SetEditableSelectionOffsets(JNIEnv*, jobject, |
183 int start, int end) { | 193 int start, int end) { |
184 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); | 194 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); |
185 if (!rwhi) | 195 if (!rwhi) |
186 return; | 196 return; |
187 | 197 |
188 rwhi->Send(new ViewMsg_SetEditableSelectionOffsets(rwhi->GetRoutingID(), | 198 rwhi->Send(new ViewMsg_SetEditableSelectionOffsets(rwhi->GetRoutingID(), |
189 start, end)); | 199 start, end)); |
190 } | 200 } |
191 | 201 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() { | 270 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() { |
261 DCHECK(rwhva_); | 271 DCHECK(rwhva_); |
262 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost(); | 272 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost(); |
263 if (!rwh) | 273 if (!rwh) |
264 return NULL; | 274 return NULL; |
265 | 275 |
266 return RenderWidgetHostImpl::From(rwh); | 276 return RenderWidgetHostImpl::From(rwh); |
267 } | 277 } |
268 | 278 |
269 } // namespace content | 279 } // namespace content |
OLD | NEW |