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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/frame_host/render_frame_host_impl.h" 5 #include "content/browser/frame_host/render_frame_host_impl.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 accessibility_reset_count_(0), 332 accessibility_reset_count_(0),
333 browser_plugin_embedder_ax_tree_id_(AXTreeIDRegistry::kNoAXTreeID), 333 browser_plugin_embedder_ax_tree_id_(AXTreeIDRegistry::kNoAXTreeID),
334 no_create_browser_accessibility_manager_for_testing_(false), 334 no_create_browser_accessibility_manager_for_testing_(false),
335 web_ui_type_(WebUI::kNoWebUI), 335 web_ui_type_(WebUI::kNoWebUI),
336 pending_web_ui_type_(WebUI::kNoWebUI), 336 pending_web_ui_type_(WebUI::kNoWebUI),
337 should_reuse_web_ui_(false), 337 should_reuse_web_ui_(false),
338 has_selection_(false), 338 has_selection_(false),
339 last_navigation_lofi_state_(LOFI_UNSPECIFIED), 339 last_navigation_lofi_state_(LOFI_UNSPECIFIED),
340 frame_host_binding_(this), 340 frame_host_binding_(this),
341 waiting_for_init_(renderer_initiated_creation), 341 waiting_for_init_(renderer_initiated_creation),
342 has_focused_editable_element_(false),
342 weak_ptr_factory_(this) { 343 weak_ptr_factory_(this) {
343 frame_tree_->AddRenderViewHostRef(render_view_host_); 344 frame_tree_->AddRenderViewHostRef(render_view_host_);
344 GetProcess()->AddRoute(routing_id_, this); 345 GetProcess()->AddRoute(routing_id_, this);
345 g_routing_id_frame_map.Get().insert(std::make_pair( 346 g_routing_id_frame_map.Get().insert(std::make_pair(
346 RenderFrameHostID(GetProcess()->GetID(), routing_id_), 347 RenderFrameHostID(GetProcess()->GetID(), routing_id_),
347 this)); 348 this));
348 site_instance_->AddObserver(this); 349 site_instance_->AddObserver(this);
349 GetSiteInstance()->IncrementActiveFrameCount(); 350 GetSiteInstance()->IncrementActiveFrameCount();
350 351
351 if (frame_tree_node_->parent()) { 352 if (frame_tree_node_->parent()) {
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
741 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_SnapshotResponse, 742 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_SnapshotResponse,
742 OnAccessibilitySnapshotResponse) 743 OnAccessibilitySnapshotResponse)
743 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) 744 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen)
744 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) 745 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading)
745 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) 746 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading)
746 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, 747 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress,
747 OnDidChangeLoadProgress) 748 OnDidChangeLoadProgress)
748 IPC_MESSAGE_HANDLER(FrameHostMsg_SerializeAsMHTMLResponse, 749 IPC_MESSAGE_HANDLER(FrameHostMsg_SerializeAsMHTMLResponse,
749 OnSerializeAsMHTMLResponse) 750 OnSerializeAsMHTMLResponse)
750 IPC_MESSAGE_HANDLER(FrameHostMsg_SelectionChanged, OnSelectionChanged) 751 IPC_MESSAGE_HANDLER(FrameHostMsg_SelectionChanged, OnSelectionChanged)
752 IPC_MESSAGE_HANDLER(FrameHostMsg_FocusedNodeChanged, OnFocusedNodeChanged)
751 #if defined(USE_EXTERNAL_POPUP_MENU) 753 #if defined(USE_EXTERNAL_POPUP_MENU)
752 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) 754 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup)
753 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) 755 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup)
754 #endif 756 #endif
755 IPC_END_MESSAGE_MAP() 757 IPC_END_MESSAGE_MAP()
756 758
757 // No further actions here, since we may have been deleted. 759 // No further actions here, since we may have been deleted.
758 return handled; 760 return handled;
759 } 761 }
760 762
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after
2144 renderer_main_thread_time); 2146 renderer_main_thread_time);
2145 } 2147 }
2146 2148
2147 void RenderFrameHostImpl::OnSelectionChanged(const base::string16& text, 2149 void RenderFrameHostImpl::OnSelectionChanged(const base::string16& text,
2148 uint32_t offset, 2150 uint32_t offset,
2149 const gfx::Range& range) { 2151 const gfx::Range& range) {
2150 has_selection_ = !text.empty(); 2152 has_selection_ = !text.empty();
2151 GetRenderWidgetHost()->SelectionChanged(text, offset, range); 2153 GetRenderWidgetHost()->SelectionChanged(text, offset, range);
2152 } 2154 }
2153 2155
2156 void RenderFrameHostImpl::OnFocusedNodeChanged(
2157 bool is_editable_element,
2158 const gfx::Rect& bounds_in_frame_widget) {
2159 if (!GetView())
2160 return;
2161
2162 has_focused_editable_element_ = is_editable_element;
2163 // First convert the bounds to root view.
2164 delegate_->OnFocusedElementChangedInFrame(
2165 this, gfx::Rect(GetView()->TransformPointToRootCoordSpace(
2166 bounds_in_frame_widget.origin()),
2167 bounds_in_frame_widget.size()));
2168 }
2169
2154 #if defined(USE_EXTERNAL_POPUP_MENU) 2170 #if defined(USE_EXTERNAL_POPUP_MENU)
2155 void RenderFrameHostImpl::OnShowPopup( 2171 void RenderFrameHostImpl::OnShowPopup(
2156 const FrameHostMsg_ShowPopup_Params& params) { 2172 const FrameHostMsg_ShowPopup_Params& params) {
2157 RenderViewHostDelegateView* view = 2173 RenderViewHostDelegateView* view =
2158 render_view_host_->delegate_->GetDelegateView(); 2174 render_view_host_->delegate_->GetDelegateView();
2159 if (view) { 2175 if (view) {
2160 gfx::Point original_point(params.bounds.x(), params.bounds.y()); 2176 gfx::Point original_point(params.bounds.x(), params.bounds.y());
2161 gfx::Point transformed_point = 2177 gfx::Point transformed_point =
2162 static_cast<RenderWidgetHostViewBase*>(GetView()) 2178 static_cast<RenderWidgetHostViewBase*>(GetView())
2163 ->TransformPointToRootCoordSpace(original_point); 2179 ->TransformPointToRootCoordSpace(original_point);
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
2793 } 2809 }
2794 2810
2795 void RenderFrameHostImpl::SuppressFurtherDialogs() { 2811 void RenderFrameHostImpl::SuppressFurtherDialogs() {
2796 Send(new FrameMsg_SuppressFurtherDialogs(GetRoutingID())); 2812 Send(new FrameMsg_SuppressFurtherDialogs(GetRoutingID()));
2797 } 2813 }
2798 2814
2799 void RenderFrameHostImpl::SetHasReceivedUserGesture() { 2815 void RenderFrameHostImpl::SetHasReceivedUserGesture() {
2800 Send(new FrameMsg_SetHasReceivedUserGesture(GetRoutingID())); 2816 Send(new FrameMsg_SetHasReceivedUserGesture(GetRoutingID()));
2801 } 2817 }
2802 2818
2819 void RenderFrameHostImpl::ClearFocusedElement() {
2820 has_focused_editable_element_ = false;
2821 Send(new FrameMsg_ClearFocusedElement(GetRoutingID()));
2822 }
2823
2803 bool RenderFrameHostImpl::IsSameSiteInstance( 2824 bool RenderFrameHostImpl::IsSameSiteInstance(
2804 RenderFrameHostImpl* other_render_frame_host) { 2825 RenderFrameHostImpl* other_render_frame_host) {
2805 // As a sanity check, make sure the frame belongs to the same BrowserContext. 2826 // As a sanity check, make sure the frame belongs to the same BrowserContext.
2806 CHECK_EQ(GetSiteInstance()->GetBrowserContext(), 2827 CHECK_EQ(GetSiteInstance()->GetBrowserContext(),
2807 other_render_frame_host->GetSiteInstance()->GetBrowserContext()); 2828 other_render_frame_host->GetSiteInstance()->GetBrowserContext());
2808 return GetSiteInstance() == other_render_frame_host->GetSiteInstance(); 2829 return GetSiteInstance() == other_render_frame_host->GetSiteInstance();
2809 } 2830 }
2810 2831
2811 void RenderFrameHostImpl::SetAccessibilityMode(AccessibilityMode mode) { 2832 void RenderFrameHostImpl::SetAccessibilityMode(AccessibilityMode mode) {
2812 Send(new FrameMsg_SetAccessibilityMode(routing_id_, mode)); 2833 Send(new FrameMsg_SetAccessibilityMode(routing_id_, mode));
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
3304 // There is no pending NavigationEntry in these cases, so pass 0 as the 3325 // There is no pending NavigationEntry in these cases, so pass 0 as the
3305 // pending_nav_entry_id. If the previous handle was a prematurely aborted 3326 // pending_nav_entry_id. If the previous handle was a prematurely aborted
3306 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. 3327 // navigation loaded via LoadDataWithBaseURL, propagate the entry id.
3307 return NavigationHandleImpl::Create( 3328 return NavigationHandleImpl::Create(
3308 params.url, frame_tree_node_, is_renderer_initiated, 3329 params.url, frame_tree_node_, is_renderer_initiated,
3309 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(), 3330 params.was_within_same_page, params.is_srcdoc, base::TimeTicks::Now(),
3310 entry_id_for_data_nav, false); // started_from_context_menu 3331 entry_id_for_data_nav, false); // started_from_context_menu
3311 } 3332 }
3312 3333
3313 } // namespace content 3334 } // namespace content
OLDNEW
« 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