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

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: -Release 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 6d5a9d7c4a08f396856ebee72852a861a6a3eb21..9781b8c5289d5f35d80d448df80f022d3f3cf4f0 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"
@@ -145,7 +146,18 @@ 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()) {
+ auto downloaded_file = base::MakeUnique<DownloadedTempFileImpl>(
+ rdh_, info->GetChildID(), info->GetRequestID(),
+ response->head.download_file_path);
+ downloaded_file_ptr = downloaded_file->CreateInterfacePtrAndBind();
+ rdh_->RegisterDownloadedTempFile(std::move(downloaded_file));
+ }
+
+ url_loader_client_->OnReceiveResponse(response->head,
+ std::move(downloaded_file_ptr));
return true;
}

Powered by Google App Engine
This is Rietveld 408576698