Index: content/browser/renderer_host/resource_dispatcher_host.cc |
diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc |
index 24ef6825bfd520b7177f8b5f97cb61a6294aaa40..d452b06a8bd6352303a586b3af746c7017110d49 100644 |
--- a/content/browser/renderer_host/resource_dispatcher_host.cc |
+++ b/content/browser/renderer_host/resource_dispatcher_host.cc |
@@ -726,12 +726,28 @@ void ResourceDispatcherHost::BeginDownload( |
request_id_--; |
+ // TODO(benjhayden) next_download_id_thunk can be a field in ResourceContext |
+ // when DownloadManager is moved to content. |
+ DownloadManager::GetNextIdThunkType* next_download_id_thunk = |
+ reinterpret_cast<DownloadManager::GetNextIdThunkType*>(context |
+ .GetUserData(reinterpret_cast<void*>(BASE_HASH_NAMESPACE:: |
+#if defined(COMPILER_GCC) |
+ hash<std::string>() |
+#elif defined(COMPILER_MSVC) |
+ hash_value |
+#endif |
+ ("next_download_id_thunk")))); |
+ CHECK(next_download_id_thunk); |
+ CHECK(!next_download_id_thunk->is_null()); |
+ DownloadId dl_id = next_download_id_thunk->Run(); |
+ |
scoped_refptr<ResourceHandler> handler( |
new DownloadResourceHandler(this, |
child_id, |
route_id, |
request_id_, |
url, |
+ dl_id, |
download_file_manager_.get(), |
request, |
prompt_for_save_location, |
@@ -752,7 +768,7 @@ void ResourceDispatcherHost::BeginDownload( |
request->set_method("GET"); |
request->set_referrer(MaybeStripReferrer(referrer).spec()); |
- request->set_context(context.request_context()); |
+ request->set_context(request_context); |
request->set_load_flags(request->load_flags() | |
net::LOAD_IS_DOWNLOAD); |