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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 void ImeAdapterAndroid::DeleteSurroundingText(JNIEnv*, | 276 void ImeAdapterAndroid::DeleteSurroundingText(JNIEnv*, |
277 const JavaParamRef<jobject>&, | 277 const JavaParamRef<jobject>&, |
278 int before, | 278 int before, |
279 int after) { | 279 int after) { |
280 RenderFrameHostImpl* rfh = | 280 RenderFrameHostImpl* rfh = |
281 static_cast<RenderFrameHostImpl*>(GetFocusedFrame()); | 281 static_cast<RenderFrameHostImpl*>(GetFocusedFrame()); |
282 if (rfh) | 282 if (rfh) |
283 rfh->DeleteSurroundingText(before, after); | 283 rfh->DeleteSurroundingText(before, after); |
284 } | 284 } |
285 | 285 |
| 286 void ImeAdapterAndroid::DeleteSurroundingTextInCodePoints( |
| 287 JNIEnv*, |
| 288 const JavaParamRef<jobject>&, |
| 289 int before, |
| 290 int after) { |
| 291 RenderFrameHostImpl* rfh = |
| 292 static_cast<RenderFrameHostImpl*>(GetFocusedFrame()); |
| 293 if (rfh) |
| 294 rfh->DeleteSurroundingTextInCodePoints(before, after); |
| 295 } |
| 296 |
286 bool ImeAdapterAndroid::RequestTextInputStateUpdate( | 297 bool ImeAdapterAndroid::RequestTextInputStateUpdate( |
287 JNIEnv* env, | 298 JNIEnv* env, |
288 const JavaParamRef<jobject>&) { | 299 const JavaParamRef<jobject>&) { |
289 RenderWidgetHostImpl* rwhi = GetFocusedWidget(); | 300 RenderWidgetHostImpl* rwhi = GetFocusedWidget(); |
290 if (!rwhi) | 301 if (!rwhi) |
291 return false; | 302 return false; |
292 rwhi->Send(new InputMsg_RequestTextInputStateUpdate(rwhi->GetRoutingID())); | 303 rwhi->Send(new InputMsg_RequestTextInputStateUpdate(rwhi->GetRoutingID())); |
293 return true; | 304 return true; |
294 } | 305 } |
295 | 306 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 Java_ImeAdapter_populateUnderlinesFromSpans( | 355 Java_ImeAdapter_populateUnderlinesFromSpans( |
345 env, obj, text, reinterpret_cast<jlong>(&underlines)); | 356 env, obj, text, reinterpret_cast<jlong>(&underlines)); |
346 | 357 |
347 // Sort spans by |.startOffset|. | 358 // Sort spans by |.startOffset|. |
348 std::sort(underlines.begin(), underlines.end()); | 359 std::sort(underlines.begin(), underlines.end()); |
349 | 360 |
350 return underlines; | 361 return underlines; |
351 } | 362 } |
352 | 363 |
353 } // namespace content | 364 } // namespace content |
OLD | NEW |