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

Unified Diff: content/browser/loader/mojo_async_resource_handler.cc

Issue 2503813002: Fix and refactor downloaded file handling in the loading stack (Closed)
Patch Set: move to dtor Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/loader/mojo_async_resource_handler.cc
diff --git a/content/browser/loader/mojo_async_resource_handler.cc b/content/browser/loader/mojo_async_resource_handler.cc
index 1288fe45136fb67142fa4ca4383a058c83eb14e9..e881a3fe86b4e7e0bab6a48bbdc2bc8b75980fc7 100644
--- a/content/browser/loader/mojo_async_resource_handler.cc
+++ b/content/browser/loader/mojo_async_resource_handler.cc
@@ -12,6 +12,7 @@
#include "base/macros.h"
#include "base/strings/string_number_conversions.h"
#include "base/time/time.h"
+#include "content/browser/loader/downloaded_temp_file_impl.h"
#include "content/browser/loader/netlog_observer.h"
#include "content/browser/loader/resource_dispatcher_host_impl.h"
#include "content/browser/loader/resource_request_info_impl.h"
@@ -163,7 +164,17 @@ bool MojoAsyncResourceHandler::OnResponseStarted(ResourceResponse* response,
response->head.request_start = request()->creation_time();
response->head.response_start = base::TimeTicks::Now();
sent_received_response_message_ = true;
- url_loader_client_->OnReceiveResponse(response->head);
+
+ mojom::DownloadedTempFilePtr downloaded_file_ptr;
+ if (!response->head.download_file_path.empty()) {
+ downloaded_file_ptr = DownloadedTempFileImpl::Create(info->GetChildID(),
+ info->GetRequestID());
+ rdh_->RegisterDownloadedTempFile(info->GetChildID(), info->GetRequestID(),
+ response->head.download_file_path);
+ }
+
+ url_loader_client_->OnReceiveResponse(response->head,
+ std::move(downloaded_file_ptr));
return true;
}
« no previous file with comments | « content/browser/loader/downloaded_temp_file_impl.cc ('k') | content/browser/loader/resource_dispatcher_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698