| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <android/input.h> | 8 #include <android/input.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 java_ime_adapter_ = JavaObjectWeakGlobalRef(env, java_object); | 240 java_ime_adapter_ = JavaObjectWeakGlobalRef(env, java_object); |
| 241 } | 241 } |
| 242 | 242 |
| 243 void ImeAdapterAndroid::CancelComposition() { | 243 void ImeAdapterAndroid::CancelComposition() { |
| 244 base::android::ScopedJavaLocalRef<jobject> obj = | 244 base::android::ScopedJavaLocalRef<jobject> obj = |
| 245 java_ime_adapter_.get(AttachCurrentThread()); | 245 java_ime_adapter_.get(AttachCurrentThread()); |
| 246 if (!obj.is_null()) | 246 if (!obj.is_null()) |
| 247 Java_ImeAdapter_cancelComposition(AttachCurrentThread(), obj.obj()); | 247 Java_ImeAdapter_cancelComposition(AttachCurrentThread(), obj.obj()); |
| 248 } | 248 } |
| 249 | 249 |
| 250 void ImeAdapterAndroid::FocusedNodeChanged(bool is_editable_node) { | 250 void ImeAdapterAndroid::FocusedNodeChanged(bool is_editable_node, |
| 251 int editable_node_max_length) { |
| 251 base::android::ScopedJavaLocalRef<jobject> obj = | 252 base::android::ScopedJavaLocalRef<jobject> obj = |
| 252 java_ime_adapter_.get(AttachCurrentThread()); | 253 java_ime_adapter_.get(AttachCurrentThread()); |
| 253 if (!obj.is_null()) { | 254 if (!obj.is_null()) { |
| 254 Java_ImeAdapter_focusedNodeChanged(AttachCurrentThread(), | 255 Java_ImeAdapter_focusedNodeChanged(AttachCurrentThread(), |
| 255 obj.obj(), | 256 obj.obj(), |
| 256 is_editable_node); | 257 is_editable_node, |
| 258 editable_node_max_length); |
| 257 } | 259 } |
| 258 } | 260 } |
| 259 | 261 |
| 260 void ImeAdapterAndroid::SetEditableSelectionOffsets(JNIEnv*, jobject, | 262 void ImeAdapterAndroid::SetEditableSelectionOffsets(JNIEnv*, jobject, |
| 261 int start, int end) { | 263 int start, int end) { |
| 262 RenderFrameHost* rfh = GetFocusedFrame(); | 264 RenderFrameHost* rfh = GetFocusedFrame(); |
| 263 if (!rfh) | 265 if (!rfh) |
| 264 return; | 266 return; |
| 265 | 267 |
| 266 rfh->Send(new FrameMsg_SetEditableSelectionOffsets(rfh->GetRoutingID(), | 268 rfh->Send(new FrameMsg_SetEditableSelectionOffsets(rfh->GetRoutingID(), |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 WebContents* ImeAdapterAndroid::GetWebContents() { | 353 WebContents* ImeAdapterAndroid::GetWebContents() { |
| 352 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); | 354 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); |
| 353 if (!rwh) | 355 if (!rwh) |
| 354 return NULL; | 356 return NULL; |
| 355 if (!rwh->IsRenderView()) | 357 if (!rwh->IsRenderView()) |
| 356 return NULL; | 358 return NULL; |
| 357 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); | 359 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); |
| 358 } | 360 } |
| 359 | 361 |
| 360 } // namespace content | 362 } // namespace content |
| OLD | NEW |