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

Side by Side Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 1811913003: PlzNavigate: support NavigationThrottle::WillProcessResponse (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on top of 1832803002 Created 4 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 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 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 } 1999 }
2000 2000
2001 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { 2001 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) {
2002 DCHECK(data_url.SchemeIs(url::kDataScheme)); 2002 DCHECK(data_url.SchemeIs(url::kDataScheme));
2003 CommonNavigationParams common_params( 2003 CommonNavigationParams common_params(
2004 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, 2004 data_url, Referrer(), ui::PAGE_TRANSITION_LINK,
2005 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), 2005 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(),
2006 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, 2006 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF,
2007 base::TimeTicks::Now(), "GET"); 2007 base::TimeTicks::Now(), "GET");
2008 if (IsBrowserSideNavigationEnabled()) { 2008 if (IsBrowserSideNavigationEnabled()) {
2009 CommitNavigation(nullptr, nullptr, common_params, 2009 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(),
2010 RequestNavigationParams()); 2010 false);
2011 } else { 2011 } else {
2012 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); 2012 Navigate(common_params, StartNavigationParams(), RequestNavigationParams());
2013 } 2013 }
2014 } 2014 }
2015 2015
2016 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, 2016 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params,
2017 SiteInstance* source_site_instance) { 2017 SiteInstance* source_site_instance) {
2018 GURL validated_url(params.url); 2018 GURL validated_url(params.url);
2019 GetProcess()->FilterURL(false, &validated_url); 2019 GetProcess()->FilterURL(false, &validated_url);
2020 2020
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2130 render_view_host_->GetWidget()->delegate()->RendererUnresponsive( 2130 render_view_host_->GetWidget()->delegate()->RendererUnresponsive(
2131 render_view_host_->GetWidget()); 2131 render_view_host_->GetWidget());
2132 } 2132 }
2133 } 2133 }
2134 2134
2135 // PlzNavigate 2135 // PlzNavigate
2136 void RenderFrameHostImpl::CommitNavigation( 2136 void RenderFrameHostImpl::CommitNavigation(
2137 ResourceResponse* response, 2137 ResourceResponse* response,
2138 scoped_ptr<StreamHandle> body, 2138 scoped_ptr<StreamHandle> body,
2139 const CommonNavigationParams& common_params, 2139 const CommonNavigationParams& common_params,
2140 const RequestNavigationParams& request_params) { 2140 const RequestNavigationParams& request_params,
2141 bool is_view_source) {
2141 DCHECK((response && body.get()) || 2142 DCHECK((response && body.get()) ||
2142 !ShouldMakeNetworkRequestForURL(common_params.url)); 2143 !ShouldMakeNetworkRequestForURL(common_params.url));
2143 UpdatePermissionsForNavigation(common_params, request_params); 2144 UpdatePermissionsForNavigation(common_params, request_params);
2144 2145
2145 // Get back to a clean state, in case we start a new navigation without 2146 // Get back to a clean state, in case we start a new navigation without
2146 // completing a RFH swap or unload handler. 2147 // completing a RFH swap or unload handler.
2147 SetState(RenderFrameHostImpl::STATE_DEFAULT); 2148 SetState(RenderFrameHostImpl::STATE_DEFAULT);
2148 2149
2150 // The renderer can exit view source mode when any error or cancellation
2151 // happen. When reusing the same renderer, overwrite to recover the mode.
2152 if (is_view_source &&
2153 this == frame_tree_node_->render_manager()->current_frame_host()) {
2154 DCHECK(!GetParent());
2155 render_view_host()->Send(new FrameMsg_EnableViewSourceMode(routing_id_));
2156 }
2157
2149 const GURL body_url = body.get() ? body->GetURL() : GURL(); 2158 const GURL body_url = body.get() ? body->GetURL() : GURL();
2150 const ResourceResponseHead head = response ? 2159 const ResourceResponseHead head = response ?
2151 response->head : ResourceResponseHead(); 2160 response->head : ResourceResponseHead();
2152 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, 2161 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params,
2153 request_params)); 2162 request_params));
2154 2163
2155 // TODO(clamy): Release the stream handle once the renderer has finished 2164 // TODO(clamy): Release the stream handle once the renderer has finished
2156 // reading it. 2165 // reading it.
2157 stream_handle_ = std::move(body); 2166 stream_handle_ = std::move(body);
2158 2167
2159 // When navigating to a Javascript url, no commit is expected from the 2168 // When navigating to a Javascript url, no commit is expected from the
2160 // RenderFrameHost, nor should the throbber start. The NavigationRequest is 2169 // RenderFrameHost, nor should the throbber start. The NavigationRequest is
2161 // also not stored in the FrameTreeNode. Therefore do not reset it, as this 2170 // also not stored in the FrameTreeNode. Therefore do not reset it, as this
2162 // could cancel an existing pending navigation. 2171 // could cancel an existing pending navigation.
2163 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) { 2172 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) {
2164 pending_commit_ = true; 2173 pending_commit_ = true;
2165 is_loading_ = true; 2174 is_loading_ = true;
2166 frame_tree_node_->ResetNavigationRequest(true);
2167 } 2175 }
2168 } 2176 }
2169 2177
2170 void RenderFrameHostImpl::FailedNavigation( 2178 void RenderFrameHostImpl::FailedNavigation(
2171 const CommonNavigationParams& common_params, 2179 const CommonNavigationParams& common_params,
2172 const RequestNavigationParams& request_params, 2180 const RequestNavigationParams& request_params,
2173 bool has_stale_copy_in_cache, 2181 bool has_stale_copy_in_cache,
2174 int error_code) { 2182 int error_code) {
2175 // Get back to a clean state, in case a new navigation started without 2183 // Get back to a clean state, in case a new navigation started without
2176 // completing a RFH swap or unload handler. 2184 // completing a RFH swap or unload handler.
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
2682 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame(); 2690 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame();
2683 if (!focused_frame_tree_node) 2691 if (!focused_frame_tree_node)
2684 return; 2692 return;
2685 RenderFrameHostImpl* focused_frame = 2693 RenderFrameHostImpl* focused_frame =
2686 focused_frame_tree_node->current_frame_host(); 2694 focused_frame_tree_node->current_frame_host();
2687 DCHECK(focused_frame); 2695 DCHECK(focused_frame);
2688 dst->focused_tree_id = focused_frame->GetAXTreeID(); 2696 dst->focused_tree_id = focused_frame->GetAXTreeID();
2689 } 2697 }
2690 2698
2691 } // namespace content 2699 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/browser/loader/navigation_resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698