| OLD | NEW |
| 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" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 WebContents* GetWebContentsFromFTNID(int frame_tree_node_id) { | 23 WebContents* GetWebContentsFromFTNID(int frame_tree_node_id) { |
| 24 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 24 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 25 FrameTreeNode* frame_tree_node = | 25 FrameTreeNode* frame_tree_node = |
| 26 FrameTreeNode::GloballyFindByID(frame_tree_node_id); | 26 FrameTreeNode::GloballyFindByID(frame_tree_node_id); |
| 27 if (!frame_tree_node) | 27 if (!frame_tree_node) |
| 28 return nullptr; | 28 return nullptr; |
| 29 | 29 |
| 30 return WebContentsImpl::FromFrameTreeNode(frame_tree_node); | 30 return WebContentsImpl::FromFrameTreeNode(frame_tree_node); |
| 31 } | 31 } |
| 32 | 32 |
| 33 int FrameTreeNodeIdFromHostIds(int render_process_host_id, |
| 34 int render_frame_host_id) { |
| 35 RenderFrameHost* render_frame_host = |
| 36 RenderFrameHost::FromID(render_process_host_id, render_frame_host_id); |
| 37 return render_frame_host ? render_frame_host->GetFrameTreeNodeId() : -1; |
| 38 } |
| 39 |
| 33 } // namespace | 40 } // namespace |
| 34 | 41 |
| 35 // ---------------------------------------------------------------------------- | 42 // ---------------------------------------------------------------------------- |
| 36 // ResourceRequestInfo | 43 // ResourceRequestInfo |
| 37 | 44 |
| 38 // static | 45 // static |
| 39 const ResourceRequestInfo* ResourceRequestInfo::ForRequest( | 46 const ResourceRequestInfo* ResourceRequestInfo::ForRequest( |
| 40 const net::URLRequest* request) { | 47 const net::URLRequest* request) { |
| 41 return ResourceRequestInfoImpl::ForRequest(request); | 48 return ResourceRequestInfoImpl::ForRequest(request); |
| 42 } | 49 } |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 int render_frame_host_id = -1; | 212 int render_frame_host_id = -1; |
| 206 if (!GetAssociatedRenderFrame(&render_process_host_id, | 213 if (!GetAssociatedRenderFrame(&render_process_host_id, |
| 207 &render_frame_host_id)) { | 214 &render_frame_host_id)) { |
| 208 NOTREACHED(); | 215 NOTREACHED(); |
| 209 } | 216 } |
| 210 | 217 |
| 211 return base::Bind(&WebContentsImpl::FromRenderFrameHostID, | 218 return base::Bind(&WebContentsImpl::FromRenderFrameHostID, |
| 212 render_process_host_id, render_frame_host_id); | 219 render_process_host_id, render_frame_host_id); |
| 213 } | 220 } |
| 214 | 221 |
| 222 ResourceRequestInfo::FrameTreeNodeIdGetter |
| 223 ResourceRequestInfoImpl::GetFrameTreeNodeIdGetterForRequest() const { |
| 224 if (frame_tree_node_id_ != -1) { |
| 225 DCHECK(IsBrowserSideNavigationEnabled()); |
| 226 return base::Bind([](int id) { return id; }, frame_tree_node_id_); |
| 227 } |
| 228 |
| 229 int render_process_host_id = -1; |
| 230 int render_frame_host_id = -1; |
| 231 if (!GetAssociatedRenderFrame(&render_process_host_id, |
| 232 &render_frame_host_id)) { |
| 233 NOTREACHED(); |
| 234 } |
| 235 |
| 236 return base::Bind(&FrameTreeNodeIdFromHostIds, render_process_host_id, |
| 237 render_frame_host_id); |
| 238 } |
| 239 |
| 215 ResourceContext* ResourceRequestInfoImpl::GetContext() const { | 240 ResourceContext* ResourceRequestInfoImpl::GetContext() const { |
| 216 return context_; | 241 return context_; |
| 217 } | 242 } |
| 218 | 243 |
| 219 int ResourceRequestInfoImpl::GetChildID() const { | 244 int ResourceRequestInfoImpl::GetChildID() const { |
| 220 return requester_info_->child_id(); | 245 return requester_info_->child_id(); |
| 221 } | 246 } |
| 222 | 247 |
| 223 int ResourceRequestInfoImpl::GetRouteID() const { | 248 int ResourceRequestInfoImpl::GetRouteID() const { |
| 224 return route_id_; | 249 return route_id_; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 on_transfer_.Run(std::move(url_loader_request), | 369 on_transfer_.Run(std::move(url_loader_request), |
| 345 std::move(url_loader_client)); | 370 std::move(url_loader_client)); |
| 346 } | 371 } |
| 347 } | 372 } |
| 348 | 373 |
| 349 void ResourceRequestInfoImpl::ResetBody() { | 374 void ResourceRequestInfoImpl::ResetBody() { |
| 350 body_ = nullptr; | 375 body_ = nullptr; |
| 351 } | 376 } |
| 352 | 377 |
| 353 } // namespace content | 378 } // namespace content |
| OLD | NEW |