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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 void ImeAdapterAndroid::DeleteSurroundingText(JNIEnv*, | 282 void ImeAdapterAndroid::DeleteSurroundingText(JNIEnv*, |
283 const JavaParamRef<jobject>&, | 283 const JavaParamRef<jobject>&, |
284 int before, | 284 int before, |
285 int after) { | 285 int after) { |
286 RenderFrameHostImpl* rfh = | 286 RenderFrameHostImpl* rfh = |
287 static_cast<RenderFrameHostImpl*>(GetFocusedFrame()); | 287 static_cast<RenderFrameHostImpl*>(GetFocusedFrame()); |
288 if (rfh) | 288 if (rfh) |
289 rfh->ExtendSelectionAndDelete(before, after); | 289 rfh->ExtendSelectionAndDelete(before, after); |
290 } | 290 } |
291 | 291 |
| 292 bool ImeAdapterAndroid::RequestTextInputStateUpdate( |
| 293 JNIEnv* env, |
| 294 const JavaParamRef<jobject>&) { |
| 295 RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); |
| 296 if (!rwhi) |
| 297 return false; |
| 298 rwhi->Send(new InputMsg_RequestTextInputStateUpdate(rwhi->GetRoutingID())); |
| 299 return true; |
| 300 } |
| 301 |
292 void ImeAdapterAndroid::ResetImeAdapter(JNIEnv* env, | 302 void ImeAdapterAndroid::ResetImeAdapter(JNIEnv* env, |
293 const JavaParamRef<jobject>&) { | 303 const JavaParamRef<jobject>&) { |
294 java_ime_adapter_.reset(); | 304 java_ime_adapter_.reset(); |
295 } | 305 } |
296 | 306 |
297 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() { | 307 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() { |
298 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 308 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
299 DCHECK(rwhva_); | 309 DCHECK(rwhva_); |
300 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost(); | 310 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost(); |
301 if (!rwh) | 311 if (!rwh) |
(...skipping 18 matching lines...) Expand all Loading... |
320 } | 330 } |
321 | 331 |
322 WebContents* ImeAdapterAndroid::GetWebContents() { | 332 WebContents* ImeAdapterAndroid::GetWebContents() { |
323 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); | 333 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); |
324 if (!rwh) | 334 if (!rwh) |
325 return nullptr; | 335 return nullptr; |
326 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); | 336 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); |
327 } | 337 } |
328 | 338 |
329 } // namespace content | 339 } // namespace content |
OLD | NEW |