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

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2623483003: Support tracking focused node element for OOPIFs. (Closed)
Patch Set: Added the missing forward declaration Created 3 years, 11 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/frame_host/render_frame_host_impl.cc
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc
index 5fee5bf452a8c6375bd263059b599b6a28256a9a..71cef3aef966401e1f8d4489468b8d8a6be16cac 100644
--- a/content/browser/frame_host/render_frame_host_impl.cc
+++ b/content/browser/frame_host/render_frame_host_impl.cc
@@ -339,6 +339,7 @@ RenderFrameHostImpl::RenderFrameHostImpl(SiteInstance* site_instance,
last_navigation_lofi_state_(LOFI_UNSPECIFIED),
frame_host_binding_(this),
waiting_for_init_(renderer_initiated_creation),
+ has_focused_editable_element_(false),
weak_ptr_factory_(this) {
frame_tree_->AddRenderViewHostRef(render_view_host_);
GetProcess()->AddRoute(routing_id_, this);
@@ -748,6 +749,7 @@ bool RenderFrameHostImpl::OnMessageReceived(const IPC::Message &msg) {
IPC_MESSAGE_HANDLER(FrameHostMsg_SerializeAsMHTMLResponse,
OnSerializeAsMHTMLResponse)
IPC_MESSAGE_HANDLER(FrameHostMsg_SelectionChanged, OnSelectionChanged)
+ IPC_MESSAGE_HANDLER(FrameHostMsg_FocusedNodeChanged, OnFocusedNodeChanged)
#if defined(USE_EXTERNAL_POPUP_MENU)
IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup)
IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup)
@@ -2151,6 +2153,20 @@ void RenderFrameHostImpl::OnSelectionChanged(const base::string16& text,
GetRenderWidgetHost()->SelectionChanged(text, offset, range);
}
+void RenderFrameHostImpl::OnFocusedNodeChanged(
+ bool is_editable_element,
+ const gfx::Rect& bounds_in_frame_widget) {
+ if (!GetView())
+ return;
+
+ has_focused_editable_element_ = is_editable_element;
+ // First convert the bounds to root view.
+ delegate_->OnFocusedElementChangedInFrame(
+ this, gfx::Rect(GetView()->TransformPointToRootCoordSpace(
+ bounds_in_frame_widget.origin()),
+ bounds_in_frame_widget.size()));
+}
+
#if defined(USE_EXTERNAL_POPUP_MENU)
void RenderFrameHostImpl::OnShowPopup(
const FrameHostMsg_ShowPopup_Params& params) {
@@ -2800,6 +2816,11 @@ void RenderFrameHostImpl::SetHasReceivedUserGesture() {
Send(new FrameMsg_SetHasReceivedUserGesture(GetRoutingID()));
}
+void RenderFrameHostImpl::ClearFocusedElement() {
+ has_focused_editable_element_ = false;
+ Send(new FrameMsg_ClearFocusedElement(GetRoutingID()));
+}
+
bool RenderFrameHostImpl::IsSameSiteInstance(
RenderFrameHostImpl* other_render_frame_host) {
// As a sanity check, make sure the frame belongs to the same BrowserContext.
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/renderer_host/render_view_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698