| OLD | NEW |
| 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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 accessibility_reset_count_(0), | 329 accessibility_reset_count_(0), |
| 330 browser_plugin_embedder_ax_tree_id_(AXTreeIDRegistry::kNoAXTreeID), | 330 browser_plugin_embedder_ax_tree_id_(AXTreeIDRegistry::kNoAXTreeID), |
| 331 no_create_browser_accessibility_manager_for_testing_(false), | 331 no_create_browser_accessibility_manager_for_testing_(false), |
| 332 web_ui_type_(WebUI::kNoWebUI), | 332 web_ui_type_(WebUI::kNoWebUI), |
| 333 pending_web_ui_type_(WebUI::kNoWebUI), | 333 pending_web_ui_type_(WebUI::kNoWebUI), |
| 334 should_reuse_web_ui_(false), | 334 should_reuse_web_ui_(false), |
| 335 has_selection_(false), | 335 has_selection_(false), |
| 336 last_navigation_lofi_state_(LOFI_UNSPECIFIED), | 336 last_navigation_lofi_state_(LOFI_UNSPECIFIED), |
| 337 frame_host_binding_(this), | 337 frame_host_binding_(this), |
| 338 waiting_for_init_(renderer_initiated_creation), | 338 waiting_for_init_(renderer_initiated_creation), |
| 339 has_focused_editable_element_(false), |
| 339 weak_ptr_factory_(this) { | 340 weak_ptr_factory_(this) { |
| 340 frame_tree_->AddRenderViewHostRef(render_view_host_); | 341 frame_tree_->AddRenderViewHostRef(render_view_host_); |
| 341 GetProcess()->AddRoute(routing_id_, this); | 342 GetProcess()->AddRoute(routing_id_, this); |
| 342 g_routing_id_frame_map.Get().insert(std::make_pair( | 343 g_routing_id_frame_map.Get().insert(std::make_pair( |
| 343 RenderFrameHostID(GetProcess()->GetID(), routing_id_), | 344 RenderFrameHostID(GetProcess()->GetID(), routing_id_), |
| 344 this)); | 345 this)); |
| 345 site_instance_->AddObserver(this); | 346 site_instance_->AddObserver(this); |
| 346 GetSiteInstance()->IncrementActiveFrameCount(); | 347 GetSiteInstance()->IncrementActiveFrameCount(); |
| 347 | 348 |
| 348 if (frame_tree_node_->parent()) { | 349 if (frame_tree_node_->parent()) { |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_SnapshotResponse, | 747 IPC_MESSAGE_HANDLER(AccessibilityHostMsg_SnapshotResponse, |
| 747 OnAccessibilitySnapshotResponse) | 748 OnAccessibilitySnapshotResponse) |
| 748 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) | 749 IPC_MESSAGE_HANDLER(FrameHostMsg_ToggleFullscreen, OnToggleFullscreen) |
| 749 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) | 750 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStartLoading, OnDidStartLoading) |
| 750 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) | 751 IPC_MESSAGE_HANDLER(FrameHostMsg_DidStopLoading, OnDidStopLoading) |
| 751 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, | 752 IPC_MESSAGE_HANDLER(FrameHostMsg_DidChangeLoadProgress, |
| 752 OnDidChangeLoadProgress) | 753 OnDidChangeLoadProgress) |
| 753 IPC_MESSAGE_HANDLER(FrameHostMsg_SerializeAsMHTMLResponse, | 754 IPC_MESSAGE_HANDLER(FrameHostMsg_SerializeAsMHTMLResponse, |
| 754 OnSerializeAsMHTMLResponse) | 755 OnSerializeAsMHTMLResponse) |
| 755 IPC_MESSAGE_HANDLER(FrameHostMsg_SelectionChanged, OnSelectionChanged) | 756 IPC_MESSAGE_HANDLER(FrameHostMsg_SelectionChanged, OnSelectionChanged) |
| 757 IPC_MESSAGE_HANDLER(FrameHostMsg_FocusedNodeChanged, OnFocusedNodeChanged) |
| 756 #if defined(USE_EXTERNAL_POPUP_MENU) | 758 #if defined(USE_EXTERNAL_POPUP_MENU) |
| 757 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) | 759 IPC_MESSAGE_HANDLER(FrameHostMsg_ShowPopup, OnShowPopup) |
| 758 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) | 760 IPC_MESSAGE_HANDLER(FrameHostMsg_HidePopup, OnHidePopup) |
| 759 #endif | 761 #endif |
| 760 IPC_END_MESSAGE_MAP() | 762 IPC_END_MESSAGE_MAP() |
| 761 | 763 |
| 762 // No further actions here, since we may have been deleted. | 764 // No further actions here, since we may have been deleted. |
| 763 return handled; | 765 return handled; |
| 764 } | 766 } |
| 765 | 767 |
| (...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2140 renderer_main_thread_time); | 2142 renderer_main_thread_time); |
| 2141 } | 2143 } |
| 2142 | 2144 |
| 2143 void RenderFrameHostImpl::OnSelectionChanged(const base::string16& text, | 2145 void RenderFrameHostImpl::OnSelectionChanged(const base::string16& text, |
| 2144 uint32_t offset, | 2146 uint32_t offset, |
| 2145 const gfx::Range& range) { | 2147 const gfx::Range& range) { |
| 2146 has_selection_ = !text.empty(); | 2148 has_selection_ = !text.empty(); |
| 2147 GetRenderWidgetHost()->SelectionChanged(text, offset, range); | 2149 GetRenderWidgetHost()->SelectionChanged(text, offset, range); |
| 2148 } | 2150 } |
| 2149 | 2151 |
| 2152 void RenderFrameHostImpl::OnFocusedNodeChanged( |
| 2153 bool is_editable_element, |
| 2154 const gfx::Rect& bounds_in_frame_widget) { |
| 2155 if (!GetView()) |
| 2156 return; |
| 2157 |
| 2158 has_focused_editable_element_ = is_editable_element; |
| 2159 // First convert the bounds to root view. |
| 2160 delegate_->OnFocusedElementChangedInFrame( |
| 2161 this, gfx::Rect(GetView()->TransformPointToRootCoordSpace( |
| 2162 bounds_in_frame_widget.origin()), |
| 2163 bounds_in_frame_widget.size())); |
| 2164 } |
| 2165 |
| 2150 #if defined(USE_EXTERNAL_POPUP_MENU) | 2166 #if defined(USE_EXTERNAL_POPUP_MENU) |
| 2151 void RenderFrameHostImpl::OnShowPopup( | 2167 void RenderFrameHostImpl::OnShowPopup( |
| 2152 const FrameHostMsg_ShowPopup_Params& params) { | 2168 const FrameHostMsg_ShowPopup_Params& params) { |
| 2153 RenderViewHostDelegateView* view = | 2169 RenderViewHostDelegateView* view = |
| 2154 render_view_host_->delegate_->GetDelegateView(); | 2170 render_view_host_->delegate_->GetDelegateView(); |
| 2155 if (view) { | 2171 if (view) { |
| 2156 gfx::Point original_point(params.bounds.x(), params.bounds.y()); | 2172 gfx::Point original_point(params.bounds.x(), params.bounds.y()); |
| 2157 gfx::Point transformed_point = | 2173 gfx::Point transformed_point = |
| 2158 static_cast<RenderWidgetHostViewBase*>(GetView()) | 2174 static_cast<RenderWidgetHostViewBase*>(GetView()) |
| 2159 ->TransformPointToRootCoordSpace(original_point); | 2175 ->TransformPointToRootCoordSpace(original_point); |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2789 } | 2805 } |
| 2790 | 2806 |
| 2791 void RenderFrameHostImpl::SuppressFurtherDialogs() { | 2807 void RenderFrameHostImpl::SuppressFurtherDialogs() { |
| 2792 Send(new FrameMsg_SuppressFurtherDialogs(GetRoutingID())); | 2808 Send(new FrameMsg_SuppressFurtherDialogs(GetRoutingID())); |
| 2793 } | 2809 } |
| 2794 | 2810 |
| 2795 void RenderFrameHostImpl::SetHasReceivedUserGesture() { | 2811 void RenderFrameHostImpl::SetHasReceivedUserGesture() { |
| 2796 Send(new FrameMsg_SetHasReceivedUserGesture(GetRoutingID())); | 2812 Send(new FrameMsg_SetHasReceivedUserGesture(GetRoutingID())); |
| 2797 } | 2813 } |
| 2798 | 2814 |
| 2815 void RenderFrameHostImpl::ClearFocusedElement() { |
| 2816 has_focused_editable_element_ = false; |
| 2817 Send(new FrameMsg_ClearFocusedElement(GetRoutingID())); |
| 2818 } |
| 2819 |
| 2799 bool RenderFrameHostImpl::IsSameSiteInstance( | 2820 bool RenderFrameHostImpl::IsSameSiteInstance( |
| 2800 RenderFrameHostImpl* other_render_frame_host) { | 2821 RenderFrameHostImpl* other_render_frame_host) { |
| 2801 // As a sanity check, make sure the frame belongs to the same BrowserContext. | 2822 // As a sanity check, make sure the frame belongs to the same BrowserContext. |
| 2802 CHECK_EQ(GetSiteInstance()->GetBrowserContext(), | 2823 CHECK_EQ(GetSiteInstance()->GetBrowserContext(), |
| 2803 other_render_frame_host->GetSiteInstance()->GetBrowserContext()); | 2824 other_render_frame_host->GetSiteInstance()->GetBrowserContext()); |
| 2804 return GetSiteInstance() == other_render_frame_host->GetSiteInstance(); | 2825 return GetSiteInstance() == other_render_frame_host->GetSiteInstance(); |
| 2805 } | 2826 } |
| 2806 | 2827 |
| 2807 void RenderFrameHostImpl::UpdateAccessibilityMode() { | 2828 void RenderFrameHostImpl::UpdateAccessibilityMode() { |
| 2808 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); | 2829 AccessibilityMode accessibility_mode = delegate_->GetAccessibilityMode(); |
| (...skipping 507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3316 // There is no pending NavigationEntry in these cases, so pass 0 as the | 3337 // There is no pending NavigationEntry in these cases, so pass 0 as the |
| 3317 // pending_nav_entry_id. If the previous handle was a prematurely aborted | 3338 // pending_nav_entry_id. If the previous handle was a prematurely aborted |
| 3318 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. | 3339 // navigation loaded via LoadDataWithBaseURL, propagate the entry id. |
| 3319 return NavigationHandleImpl::Create( | 3340 return NavigationHandleImpl::Create( |
| 3320 params.url, frame_tree_node_, is_renderer_initiated, | 3341 params.url, frame_tree_node_, is_renderer_initiated, |
| 3321 params.was_within_same_page, base::TimeTicks::Now(), | 3342 params.was_within_same_page, base::TimeTicks::Now(), |
| 3322 entry_id_for_data_nav, false); // started_from_context_menu | 3343 entry_id_for_data_nav, false); // started_from_context_menu |
| 3323 } | 3344 } |
| 3324 | 3345 |
| 3325 } // namespace content | 3346 } // namespace content |
| OLD | NEW |