Index: content/browser/loader/resource_request_info_impl.cc |
diff --git a/content/browser/loader/resource_request_info_impl.cc b/content/browser/loader/resource_request_info_impl.cc |
index 9a0371eea7159ea059bf3b4d6510221022d99ec4..d91848f64a18d546f1bc8b6376c7bfa5cf45a0b8 100644 |
--- a/content/browser/loader/resource_request_info_impl.cc |
+++ b/content/browser/loader/resource_request_info_impl.cc |
@@ -30,6 +30,13 @@ WebContents* GetWebContentsFromFTNID(int frame_tree_node_id) { |
return WebContentsImpl::FromFrameTreeNode(frame_tree_node); |
} |
+int FrameTreeNodeIdFromHostIds(int render_process_host_id, |
+ int render_frame_host_id) { |
+ RenderFrameHost* render_frame_host = |
+ RenderFrameHost::FromID(render_process_host_id, render_frame_host_id); |
+ return render_frame_host ? render_frame_host->GetFrameTreeNodeId() : -1; |
+} |
+ |
} // namespace |
// ---------------------------------------------------------------------------- |
@@ -212,6 +219,24 @@ ResourceRequestInfoImpl::GetWebContentsGetterForRequest() const { |
render_process_host_id, render_frame_host_id); |
} |
+ResourceRequestInfo::FrameTreeNodeIdGetter |
+ResourceRequestInfoImpl::GetFrameTreeNodeIdGetterForRequest() const { |
+ if (frame_tree_node_id_ != -1) { |
+ DCHECK(IsBrowserSideNavigationEnabled()); |
+ return base::Bind([](int id) { return id; }, frame_tree_node_id_); |
+ } |
+ |
+ int render_process_host_id = -1; |
+ int render_frame_host_id = -1; |
+ if (!GetAssociatedRenderFrame(&render_process_host_id, |
+ &render_frame_host_id)) { |
+ NOTREACHED(); |
+ } |
+ |
+ return base::Bind(&FrameTreeNodeIdFromHostIds, render_process_host_id, |
+ render_frame_host_id); |
+} |
+ |
ResourceContext* ResourceRequestInfoImpl::GetContext() const { |
return context_; |
} |