Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Unified Diff: content/browser/renderer_host/ime_adapter_android.cc

Issue 183923030: Almost finish moving context_menu_node_ from RenderViewImpl to RenderFrameImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync to get android fix Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/ime_adapter_android.cc
===================================================================
--- content/browser/renderer_host/ime_adapter_android.cc (revision 255719)
+++ content/browser/renderer_host/ime_adapter_android.cc (working copy)
@@ -11,9 +11,14 @@
#include "base/android/scoped_java_ref.h"
#include "base/strings/utf_string_conversions.h"
#include "base/time/time.h"
+#include "content/browser/frame_host/frame_tree.h"
+#include "content/browser/frame_host/frame_tree_node.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"
+#include "content/public/browser/browser_thread.h"
#include "content/public/browser/native_web_keyboard_event.h"
#include "jni/ImeAdapter_jni.h"
#include "third_party/WebKit/public/web/WebCompositionUnderline.h"
@@ -240,27 +245,21 @@
}
void ImeAdapterAndroid::Cut(JNIEnv* env, jobject) {
- RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl();
- if (!rwhi)
- return;
-
- rwhi->Cut();
+ RenderFrameHost* rfh = GetFocusedFrame();
+ if (rfh)
+ rfh->Cut();
}
void ImeAdapterAndroid::Copy(JNIEnv* env, jobject) {
- RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl();
- if (!rwhi)
- return;
-
- rwhi->Copy();
+ RenderFrameHost* rfh = GetFocusedFrame();
+ if (rfh)
+ rfh->Copy();
}
void ImeAdapterAndroid::Paste(JNIEnv* env, jobject) {
- RenderWidgetHostImpl* rwhi = GetRenderWidgetHostImpl();
- if (!rwhi)
- return;
-
- rwhi->Paste();
+ RenderFrameHost* rfh = GetFocusedFrame();
+ if (rfh)
+ rfh->Paste();
}
void ImeAdapterAndroid::ResetImeAdapter(JNIEnv* env, jobject) {
@@ -268,6 +267,7 @@
}
RenderWidgetHostImpl* ImeAdapterAndroid::GetRenderWidgetHostImpl() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(rwhva_);
RenderWidgetHost* rwh = rwhva_->GetRenderWidgetHost();
if (!rwh)
@@ -276,4 +276,21 @@
return RenderWidgetHostImpl::From(rwh);
}
+RenderFrameHost* ImeAdapterAndroid::GetFocusedFrame() {
+ RenderWidgetHostImpl* rwh = GetRenderWidgetHostImpl();
+ if (!rwh)
+ return NULL;
+ if (!rwh->IsRenderView())
+ return NULL;
+ RenderViewHost* rvh = RenderViewHost::From(rwh);
+ RenderFrameHostImpl* rfh =
+ static_cast<RenderFrameHostImpl*>(rvh->GetMainFrame());
+ FrameTreeNode* focused_frame =
+ rfh->frame_tree_node()->frame_tree()->GetFocusedFrame();
+ if (!focused_frame)
+ return NULL;
+
+ return focused_frame->current_frame_host();
+}
+
} // namespace content
« no previous file with comments | « content/browser/renderer_host/ime_adapter_android.h ('k') | content/browser/renderer_host/render_widget_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698