Chromium Code Reviews| Index: content/browser/renderer_host/ime_adapter_android.cc |
| =================================================================== |
| --- content/browser/renderer_host/ime_adapter_android.cc (revision 254898) |
| +++ content/browser/renderer_host/ime_adapter_android.cc (working copy) |
| @@ -11,6 +11,8 @@ |
| #include "base/android/scoped_java_ref.h" |
| #include "base/strings/utf_string_conversions.h" |
| #include "base/time/time.h" |
| +#include "content/browser/frame_host/render_frame_host_impl.h" |
| +#include "content/browser/renderer_host/render_view_host_impl.h" |
| #include "content/browser/renderer_host/render_widget_host_impl.h" |
| #include "content/browser/renderer_host/render_widget_host_view_android.h" |
| #include "content/common/view_messages.h" |
| @@ -240,27 +242,21 @@ |
| } |
| void ImeAdapterAndroid::Cut(JNIEnv* env, jobject) { |
| - RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); |
| - if (!rwhi) |
| - return; |
| - |
| - rwhi->Cut(); |
| + RenderFrameHost* rfh = GetRenderFrameHost(); |
| + if (rfh) |
| + rfh->Cut(); |
| } |
| void ImeAdapterAndroid::Copy(JNIEnv* env, jobject) { |
| - RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); |
| - if (!rwhi) |
| - return; |
| - |
| - rwhi->Copy(); |
| + RenderFrameHost* rfh = GetRenderFrameHost(); |
| + if (rfh) |
| + rfh->Copy(); |
| } |
| void ImeAdapterAndroid::Paste(JNIEnv* env, jobject) { |
| - RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl(); |
| - if (!rwhi) |
| - return; |
| - |
| - rwhi->Paste(); |
| + RenderFrameHost* rfh = GetRenderFrameHost(); |
| + if (rfh) |
| + rfh->Paste(); |
| } |
| void ImeAdapterAndroid::ResetImeAdapter(JNIEnv* env, jobject) { |
| @@ -276,4 +272,14 @@ |
| return RenderWidgetHostImpl::From(rwh); |
| } |
| +RenderFrameHost* ImeAdapterAndroid::GetRenderFrameHost() { |
|
nasko
2014/03/05 21:50:47
nit: Shouldn't this be GetFocusedRenderFrameHost?
jam
2014/03/06 00:59:37
Done.
|
| + RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl(); |
| + if (!rwh) |
| + return NULL; |
| + if (!rwh->IsRenderView()) |
| + return NULL; |
| + RenderViewHost* rvh = RenderViewHost::From(rwh); |
| + return rvh->GetFocusedFrame(); |
| +} |
| + |
| } // namespace content |