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

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: 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #include "content/browser/wake_lock/wake_lock_service_context.h" 51 #include "content/browser/wake_lock/wake_lock_service_context.h"
52 #include "content/browser/webui/web_ui_controller_factory_registry.h" 52 #include "content/browser/webui/web_ui_controller_factory_registry.h"
53 #include "content/common/accessibility_messages.h" 53 #include "content/common/accessibility_messages.h"
54 #include "content/common/frame_messages.h" 54 #include "content/common/frame_messages.h"
55 #include "content/common/input_messages.h" 55 #include "content/common/input_messages.h"
56 #include "content/common/inter_process_time_ticks_converter.h" 56 #include "content/common/inter_process_time_ticks_converter.h"
57 #include "content/common/navigation_params.h" 57 #include "content/common/navigation_params.h"
58 #include "content/common/render_frame_setup.mojom.h" 58 #include "content/common/render_frame_setup.mojom.h"
59 #include "content/common/site_isolation_policy.h" 59 #include "content/common/site_isolation_policy.h"
60 #include "content/common/swapped_out_messages.h" 60 #include "content/common/swapped_out_messages.h"
61 #include "content/common/view_messages.h"
nasko 2016/03/18 21:51:43 This makes me sad. RenderFrame(Host) objects shoul
clamy 2016/03/23 14:36:44 Done.
61 #include "content/public/browser/ax_event_notification_details.h" 62 #include "content/public/browser/ax_event_notification_details.h"
62 #include "content/public/browser/browser_accessibility_state.h" 63 #include "content/public/browser/browser_accessibility_state.h"
63 #include "content/public/browser/browser_context.h" 64 #include "content/public/browser/browser_context.h"
64 #include "content/public/browser/browser_plugin_guest_manager.h" 65 #include "content/public/browser/browser_plugin_guest_manager.h"
65 #include "content/public/browser/browser_thread.h" 66 #include "content/public/browser/browser_thread.h"
66 #include "content/public/browser/content_browser_client.h" 67 #include "content/public/browser/content_browser_client.h"
67 #include "content/public/browser/permission_manager.h" 68 #include "content/public/browser/permission_manager.h"
68 #include "content/public/browser/permission_type.h" 69 #include "content/public/browser/permission_type.h"
69 #include "content/public/browser/render_process_host.h" 70 #include "content/public/browser/render_process_host.h"
70 #include "content/public/browser/render_widget_host_view.h" 71 #include "content/public/browser/render_widget_host_view.h"
(...skipping 1928 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 } 2000 }
2000 2001
2001 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { 2002 void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) {
2002 DCHECK(data_url.SchemeIs(url::kDataScheme)); 2003 DCHECK(data_url.SchemeIs(url::kDataScheme));
2003 CommonNavigationParams common_params( 2004 CommonNavigationParams common_params(
2004 data_url, Referrer(), ui::PAGE_TRANSITION_LINK, 2005 data_url, Referrer(), ui::PAGE_TRANSITION_LINK,
2005 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(), 2006 FrameMsg_Navigate_Type::NORMAL, false, false, base::TimeTicks::Now(),
2006 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF, 2007 FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), LOFI_OFF,
2007 base::TimeTicks::Now(), "GET"); 2008 base::TimeTicks::Now(), "GET");
2008 if (IsBrowserSideNavigationEnabled()) { 2009 if (IsBrowserSideNavigationEnabled()) {
2009 CommitNavigation(nullptr, nullptr, common_params, 2010 CommitNavigation(nullptr, nullptr, common_params, RequestNavigationParams(),
2010 RequestNavigationParams()); 2011 false);
2011 } else { 2012 } else {
2012 Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); 2013 Navigate(common_params, StartNavigationParams(), RequestNavigationParams());
2013 } 2014 }
2014 } 2015 }
2015 2016
2016 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params, 2017 void RenderFrameHostImpl::OpenURL(const FrameHostMsg_OpenURL_Params& params,
2017 SiteInstance* source_site_instance) { 2018 SiteInstance* source_site_instance) {
2018 GURL validated_url(params.url); 2019 GURL validated_url(params.url);
2019 GetProcess()->FilterURL(false, &validated_url); 2020 GetProcess()->FilterURL(false, &validated_url);
2020 2021
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
2130 render_view_host_->GetWidget()->delegate()->RendererUnresponsive( 2131 render_view_host_->GetWidget()->delegate()->RendererUnresponsive(
2131 render_view_host_->GetWidget()); 2132 render_view_host_->GetWidget());
2132 } 2133 }
2133 } 2134 }
2134 2135
2135 // PlzNavigate 2136 // PlzNavigate
2136 void RenderFrameHostImpl::CommitNavigation( 2137 void RenderFrameHostImpl::CommitNavigation(
2137 ResourceResponse* response, 2138 ResourceResponse* response,
2138 scoped_ptr<StreamHandle> body, 2139 scoped_ptr<StreamHandle> body,
2139 const CommonNavigationParams& common_params, 2140 const CommonNavigationParams& common_params,
2140 const RequestNavigationParams& request_params) { 2141 const RequestNavigationParams& request_params,
2142 bool is_view_source) {
2141 DCHECK((response && body.get()) || 2143 DCHECK((response && body.get()) ||
2142 !ShouldMakeNetworkRequestForURL(common_params.url)); 2144 !ShouldMakeNetworkRequestForURL(common_params.url));
2143 UpdatePermissionsForNavigation(common_params, request_params); 2145 UpdatePermissionsForNavigation(common_params, request_params);
2144 2146
2145 // Get back to a clean state, in case we start a new navigation without 2147 // Get back to a clean state, in case we start a new navigation without
2146 // completing a RFH swap or unload handler. 2148 // completing a RFH swap or unload handler.
2147 SetState(RenderFrameHostImpl::STATE_DEFAULT); 2149 SetState(RenderFrameHostImpl::STATE_DEFAULT);
2148 2150
2151 // The renderer can exit view source mode when any error or cancellation
2152 // happen. When reusing the same renderer, overwrite to recover the mode.
2153 if (is_view_source &&
2154 this == frame_tree_node_->render_manager()->current_frame_host()) {
2155 DCHECK(!GetParent());
2156 render_view_host()->Send(
2157 new ViewMsg_EnableViewSourceMode(render_view_host()->GetRoutingID()));
nasko 2016/03/18 21:51:43 View source can never have subframes. Why not move
clamy 2016/03/23 14:36:44 Done. This adds a bit more changes though.
nasko 2016/03/23 22:16:46 This could always be landed as a small separate CL
2158 }
2159
2149 const GURL body_url = body.get() ? body->GetURL() : GURL(); 2160 const GURL body_url = body.get() ? body->GetURL() : GURL();
2150 const ResourceResponseHead head = response ? 2161 const ResourceResponseHead head = response ?
2151 response->head : ResourceResponseHead(); 2162 response->head : ResourceResponseHead();
2152 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params, 2163 Send(new FrameMsg_CommitNavigation(routing_id_, head, body_url, common_params,
2153 request_params)); 2164 request_params));
2154 2165
2155 // TODO(clamy): Release the stream handle once the renderer has finished 2166 // TODO(clamy): Release the stream handle once the renderer has finished
2156 // reading it. 2167 // reading it.
2157 stream_handle_ = std::move(body); 2168 stream_handle_ = std::move(body);
2158 2169
2159 // When navigating to a Javascript url, no commit is expected from the 2170 // When navigating to a Javascript url, no commit is expected from the
2160 // RenderFrameHost, nor should the throbber start. The NavigationRequest is 2171 // RenderFrameHost, nor should the throbber start. The NavigationRequest is
2161 // also not stored in the FrameTreeNode. Therefore do not reset it, as this 2172 // also not stored in the FrameTreeNode. Therefore do not reset it, as this
2162 // could cancel an existing pending navigation. 2173 // could cancel an existing pending navigation.
2163 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) { 2174 if (!common_params.url.SchemeIs(url::kJavaScriptScheme)) {
2164 pending_commit_ = true; 2175 pending_commit_ = true;
2165 is_loading_ = true; 2176 is_loading_ = true;
2166 frame_tree_node_->ResetNavigationRequest(true);
2167 } 2177 }
2168 } 2178 }
2169 2179
2170 void RenderFrameHostImpl::FailedNavigation( 2180 void RenderFrameHostImpl::FailedNavigation(
2171 const CommonNavigationParams& common_params, 2181 const CommonNavigationParams& common_params,
2172 const RequestNavigationParams& request_params, 2182 const RequestNavigationParams& request_params,
2173 bool has_stale_copy_in_cache, 2183 bool has_stale_copy_in_cache,
2174 int error_code) { 2184 int error_code) {
2175 // Get back to a clean state, in case a new navigation started without 2185 // Get back to a clean state, in case a new navigation started without
2176 // completing a RFH swap or unload handler. 2186 // completing a RFH swap or unload handler.
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
2696 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame(); 2706 FrameTreeNode* focused_frame_tree_node = frame_tree_->GetFocusedFrame();
2697 if (!focused_frame_tree_node) 2707 if (!focused_frame_tree_node)
2698 return; 2708 return;
2699 RenderFrameHostImpl* focused_frame = 2709 RenderFrameHostImpl* focused_frame =
2700 focused_frame_tree_node->current_frame_host(); 2710 focused_frame_tree_node->current_frame_host();
2701 DCHECK(focused_frame); 2711 DCHECK(focused_frame);
2702 dst->focused_tree_id = focused_frame->GetAXTreeID(); 2712 dst->focused_tree_id = focused_frame->GetAXTreeID();
2703 } 2713 }
2704 2714
2705 } // namespace content 2715 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698