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 |
293 void ImeAdapterAndroid::ResetImeAdapter(JNIEnv* env, | 303 void ImeAdapterAndroid::ResetImeAdapter(JNIEnv* env, |
294 const JavaParamRef<jobject>&) { | 304 const JavaParamRef<jobject>&) { |
295 java_ime_adapter_.reset(); | 305 java_ime_adapter_.reset(); |
296 } | 306 } |
297 | 307 |
298 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() { | 308 RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() { |
299 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 309 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
300 DCHECK(rwhva_); | 310 DCHECK(rwhva_); |
301 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost(); | 311 RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost(); |
302 if (!rwh) | 312 if (!rwh) |
(...skipping 18 matching lines...) Expand all Loading... |
321 } | 331 } |
322 | 332 |
323 WebContents* ImeAdapterAndroid::GetWebContents() { | 333 WebContents* ImeAdapterAndroid::GetWebContents() { |
324 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); | 334 RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); |
325 if (!rwh) | 335 if (!rwh) |
326 return nullptr; | 336 return nullptr; |
327 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); | 337 return WebContents::FromRenderViewHost(RenderViewHost::From(rwh)); |
328 } | 338 } |
329 | 339 |
330 } // namespace content | 340 } // namespace content |
OLD | NEW |