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

Side by Side Diff: content/browser/loader/resource_request_info_impl.cc

Issue 2860903006: Handle webuis when using the network service. (Closed)
Patch Set: merge Created 3 years, 7 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/loader/resource_request_info_impl.h" 5 #include "content/browser/loader/resource_request_info_impl.h"
6 6
7 #include "content/browser/frame_host/frame_tree_node.h" 7 #include "content/browser/frame_host/frame_tree_node.h"
8 #include "content/browser/loader/global_routing_id.h" 8 #include "content/browser/loader/global_routing_id.h"
9 #include "content/browser/loader/resource_message_filter.h" 9 #include "content/browser/loader/resource_message_filter.h"
10 #include "content/browser/web_contents/web_contents_impl.h" 10 #include "content/browser/web_contents/web_contents_impl.h"
11 #include "content/common/net/url_request_service_worker_data.h" 11 #include "content/common/net/url_request_service_worker_data.h"
12 #include "content/common/net/url_request_user_data.h" 12 #include "content/common/net/url_request_user_data.h"
13 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 #include "content/public/browser/global_request_id.h" 14 #include "content/public/browser/global_request_id.h"
15 #include "content/public/common/browser_side_navigation_policy.h" 15 #include "content/public/common/browser_side_navigation_policy.h"
16 #include "content/public/common/process_type.h" 16 #include "content/public/common/process_type.h"
17 #include "net/url_request/url_request.h" 17 #include "net/url_request/url_request.h"
18 18
19 namespace content { 19 namespace content {
20 20
21 namespace { 21 namespace {
22 22
23 WebContents* GetWebContentsFromFTNID(int frame_tree_node_id) {
24 DCHECK_CURRENTLY_ON(BrowserThread::UI);
25 FrameTreeNode* frame_tree_node =
26 FrameTreeNode::GloballyFindByID(frame_tree_node_id);
27 if (!frame_tree_node)
28 return nullptr;
29
30 return WebContentsImpl::FromFrameTreeNode(frame_tree_node);
31 }
32
33 int FrameTreeNodeIdFromHostIds(int render_process_host_id, 23 int FrameTreeNodeIdFromHostIds(int render_process_host_id,
34 int render_frame_host_id) { 24 int render_frame_host_id) {
35 RenderFrameHost* render_frame_host = 25 RenderFrameHost* render_frame_host =
36 RenderFrameHost::FromID(render_process_host_id, render_frame_host_id); 26 RenderFrameHost::FromID(render_process_host_id, render_frame_host_id);
37 return render_frame_host ? render_frame_host->GetFrameTreeNodeId() : -1; 27 return render_frame_host ? render_frame_host->GetFrameTreeNodeId() : -1;
38 } 28 }
39 29
40 } // namespace 30 } // namespace
41 31
42 // ---------------------------------------------------------------------------- 32 // ----------------------------------------------------------------------------
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 ResourceRequestInfoImpl::~ResourceRequestInfoImpl() { 186 ResourceRequestInfoImpl::~ResourceRequestInfoImpl() {
197 } 187 }
198 188
199 ResourceRequestInfo::WebContentsGetter 189 ResourceRequestInfo::WebContentsGetter
200 ResourceRequestInfoImpl::GetWebContentsGetterForRequest() const { 190 ResourceRequestInfoImpl::GetWebContentsGetterForRequest() const {
201 // PlzNavigate: navigation requests are created with a valid FrameTreeNode ID 191 // PlzNavigate: navigation requests are created with a valid FrameTreeNode ID
202 // and invalid RenderProcessHost and RenderFrameHost IDs. The FrameTreeNode 192 // and invalid RenderProcessHost and RenderFrameHost IDs. The FrameTreeNode
203 // ID should be used to access the WebContents. 193 // ID should be used to access the WebContents.
204 if (frame_tree_node_id_ != -1) { 194 if (frame_tree_node_id_ != -1) {
205 DCHECK(IsBrowserSideNavigationEnabled()); 195 DCHECK(IsBrowserSideNavigationEnabled());
206 return base::Bind(&GetWebContentsFromFTNID, frame_tree_node_id_); 196 return base::Bind(WebContents::FromFrameTreeNodeId, frame_tree_node_id_);
207 } 197 }
208 198
209 // In other cases, use the RenderProcessHost ID + RenderFrameHost ID to get 199 // In other cases, use the RenderProcessHost ID + RenderFrameHost ID to get
210 // the WebContents. 200 // the WebContents.
211 int render_process_host_id = -1; 201 int render_process_host_id = -1;
212 int render_frame_host_id = -1; 202 int render_frame_host_id = -1;
213 if (!GetAssociatedRenderFrame(&render_process_host_id, 203 if (!GetAssociatedRenderFrame(&render_process_host_id,
214 &render_frame_host_id)) { 204 &render_frame_host_id)) {
215 NOTREACHED(); 205 NOTREACHED();
216 } 206 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 on_transfer_.Run(std::move(url_loader_request), 359 on_transfer_.Run(std::move(url_loader_request),
370 std::move(url_loader_client)); 360 std::move(url_loader_client));
371 } 361 }
372 } 362 }
373 363
374 void ResourceRequestInfoImpl::ResetBody() { 364 void ResourceRequestInfoImpl::ResetBody() {
375 body_ = nullptr; 365 body_ = nullptr;
376 } 366 }
377 367
378 } // namespace content 368 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/navigation_url_loader_network_service.cc ('k') | content/browser/storage_partition_impl_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698