Chromium Code Reviews| 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 304bcaf8b11ced008b8c49e2dcc039fb548dabac..e0662cc2cf7a89cb34c7f5df375a0fd743c93fe3 100644 |
| --- a/content/browser/frame_host/render_frame_host_impl.cc |
| +++ b/content/browser/frame_host/render_frame_host_impl.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/containers/hash_tables.h" |
| #include "base/lazy_instance.h" |
| #include "base/metrics/user_metrics_action.h" |
| +#include "content/browser/child_process_security_policy_impl.h" |
| #include "content/browser/frame_host/cross_process_frame_connector.h" |
| #include "content/browser/frame_host/frame_tree.h" |
| #include "content/browser/frame_host/frame_tree_node.h" |
| @@ -14,6 +15,7 @@ |
| #include "content/browser/frame_host/render_frame_host_delegate.h" |
| #include "content/browser/renderer_host/render_view_host_impl.h" |
| #include "content/common/frame_messages.h" |
| +#include "content/common/view_messages.h" |
|
Charlie Reis
2014/02/13 01:23:53
Why do we need this?
nasko
2014/02/13 17:05:27
Done.
|
| #include "content/public/browser/browser_thread.h" |
| #include "content/public/browser/content_browser_client.h" |
| #include "content/public/browser/render_process_host.h" |
| @@ -360,4 +362,65 @@ bool RenderFrameHostImpl::CanCommitURL(const GURL& url) { |
| return GetContentClient()->browser()->CanCommitURL(GetProcess(), url); |
| } |
| +void RenderFrameHostImpl::Navigate(const FrameMsg_Navigate_Params& params) { |
| + TRACE_EVENT0("renderer_host", "RenderFrameHostImpl::Navigate"); |
|
Charlie Reis
2014/02/13 01:23:53
Does this require any other bookkeeping to registe
nasko
2014/02/13 17:05:27
Nothing else is required, this is used for about:t
|
| + // Browser plugin guests are not allowed to navigate outside web-safe schemes, |
| + // so do not grant them the ability to request additional URLs. |
| + if (!GetProcess()->IsGuest()) { |
| + ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( |
| + GetProcess()->GetID(), params.url); |
| + if (params.url.SchemeIs(kDataScheme) && |
| + params.base_url_for_data_url.SchemeIs(kFileScheme)) { |
| + // If 'data:' is used, and we have a 'file:' base url, grant access to |
| + // local files. |
| + ChildProcessSecurityPolicyImpl::GetInstance()->GrantRequestURL( |
| + GetProcess()->GetID(), params.base_url_for_data_url); |
| + } |
| + } |
| + |
| + // Only send the message if we aren't suspended at the start of a cross-site |
| + // request. |
| + if (render_view_host_->navigations_suspended_) { |
| + // Shouldn't be possible to have a second navigation while suspended, since |
| + // navigations will only be suspended during a cross-site request. If a |
| + // second navigation occurs, RenderFrameHostManager will cancel this pending |
| + // RFH and create a new pending RFH. |
| + DCHECK(!render_view_host_->suspended_nav_params_.get()); |
| + render_view_host_->suspended_nav_params_.reset( |
| + new FrameMsg_Navigate_Params(params)); |
| + } else { |
| + // Get back to a clean state, in case we start a new navigation without |
| + // completing a RVH swap or unload handler. |
| + render_view_host_->SetState(RenderViewHostImpl::STATE_DEFAULT); |
| + |
| + Send(new FrameMsg_Navigate(GetRoutingID(), params)); |
| + } |
| + |
| + // Force the throbber to start. We do this because Blink's "started |
| + // loading" message will be received asynchronously from the UI of the |
| + // browser. But we want to keep the throbber in sync with what's happening |
| + // in the UI. For example, we want to start throbbing immediately when the |
| + // user naivgates even if the renderer is delayed. There is also an issue |
| + // with the throbber starting because the WebUI (which controls whether the |
| + // favicon is displayed) happens synchronously. If the start loading |
| + // messages was asynchronous, then the default favicon would flash in. |
| + // |
| + // Blink doesn't send throb notifications for JavaScript URLs, so we |
| + // don't want to either. |
| + if (!params.url.SchemeIs(kJavaScriptScheme)) |
| + delegate_->DidStartLoading(this); |
| +} |
| + |
| +void RenderFrameHostImpl::NavigateToURL(const GURL& url) { |
| + FrameMsg_Navigate_Params params; |
| + params.page_id = -1; |
| + params.pending_history_list_offset = -1; |
| + params.current_history_list_offset = -1; |
| + params.current_history_list_length = 0; |
| + params.url = url; |
| + params.transition = PAGE_TRANSITION_LINK; |
| + params.navigation_type = FrameMsg_Navigate_Type::NORMAL; |
| + Navigate(params); |
| +} |
| + |
| } // namespace content |