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