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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 void ImeAdapterAndroid::DeleteSurroundingText(JNIEnv*, | 278 void ImeAdapterAndroid::DeleteSurroundingText(JNIEnv*, |
279 const JavaParamRef<jobject>&, | 279 const JavaParamRef<jobject>&, |
280 int before, | 280 int before, |
281 int after) { | 281 int after) { |
282 RenderFrameHostImpl* rfh = | 282 RenderFrameHostImpl* rfh = |
283 static_cast<RenderFrameHostImpl*>(GetFocusedFrame()); | 283 static_cast<RenderFrameHostImpl*>(GetFocusedFrame()); |
284 if (rfh) | 284 if (rfh) |
285 rfh->DeleteSurroundingText(before, after); | 285 rfh->DeleteSurroundingText(before, after); |
286 } | 286 } |
287 | 287 |
| 288 void ImeAdapterAndroid::DeleteSurroundingTextInCodePoints( |
| 289 JNIEnv*, |
| 290 const JavaParamRef<jobject>&, |
| 291 int before, |
| 292 int after) { |
| 293 RenderFrameHostImpl* rfh = |
| 294 static_cast<RenderFrameHostImpl*>(GetFocusedFrame()); |
| 295 if (rfh) |
| 296 rfh->DeleteSurroundingTextInCodePoints(before, after); |
| 297 } |
| 298 |
288 bool ImeAdapterAndroid::RequestTextInputStateUpdate( | 299 bool ImeAdapterAndroid::RequestTextInputStateUpdate( |
289 JNIEnv* env, | 300 JNIEnv* env, |
290 const JavaParamRef<jobject>&) { | 301 const JavaParamRef<jobject>&) { |
291 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); | 302 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); |
292 if (!rwhi) | 303 if (!rwhi) |
293 return false; | 304 return false; |
294 rwhi->Send(new InputMsg_RequestTextInputStateUpdate(rwhi->GetRoutingID())); | 305 rwhi->Send(new InputMsg_RequestTextInputStateUpdate(rwhi->GetRoutingID())); |
295 return true; | 306 return true; |
296 } | 307 } |
297 | 308 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 Java_ImeAdapter_populateUnderlinesFromSpans( | 368 Java_ImeAdapter_populateUnderlinesFromSpans( |
358 env, obj, text, reinterpret_cast<jlong>(&underlines)); | 369 env, obj, text, reinterpret_cast<jlong>(&underlines)); |
359 | 370 |
360 // Sort spans by |.startOffset|. | 371 // Sort spans by |.startOffset|. |
361 std::sort(underlines.begin(), underlines.end()); | 372 std::sort(underlines.begin(), underlines.end()); |
362 | 373 |
363 return underlines; | 374 return underlines; |
364 } | 375 } |
365 | 376 |
366 } // namespace content | 377 } // namespace content |
OLD | NEW |