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

Unified Diff: content/browser/background_fetch/background_fetch_data_manager.cc

Issue 2805813006: Set the Content-Type and Content-Length headers for BG Fetch (Closed)
Patch Set: Set the Content-Type and Content-Length headers for BG Fetch Created 3 years, 8 months 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
« no previous file with comments | « no previous file | content/browser/background_fetch/background_fetch_request_info.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/background_fetch/background_fetch_data_manager.cc
diff --git a/content/browser/background_fetch/background_fetch_data_manager.cc b/content/browser/background_fetch/background_fetch_data_manager.cc
index 64d62d78f70d8814fe4c9178efa78a1e8737389d..24909e37f2629cb177ad79cc209b007593794272 100644
--- a/content/browser/background_fetch/background_fetch_data_manager.cc
+++ b/content/browser/background_fetch/background_fetch_data_manager.cc
@@ -207,11 +207,21 @@ void BackgroundFetchDataManager::GetSettledFetchesForRegistration(
settled_fetch.request = request->fetch_request();
settled_fetch.response.url_list = request->GetURLChain();
- // TODO: settled_fetch.response.status_code
+
+ // TODO(peter): The |status_code| should match what the download manager ran
+ // in to in the BackgroundFetchResponseInfo.
+ settled_fetch.response.status_code = 200;
// TODO: settled_fetch.response.status_text
+
settled_fetch.response.response_type =
blink::WebServiceWorkerResponseTypeDefault;
- // TODO: settled_fetch.response.headers
+
+ // TODO(peter): The |headers| should be set to the real response headers,
+ // but the download manager does not relay those to us yet.
+ if (!request->GetResponseType().empty()) {
+ settled_fetch.response.headers["Content-Type"] =
+ request->GetResponseType();
+ }
if (request->GetFileSize() > 0) {
DCHECK(!request->GetFilePath().empty());
@@ -226,6 +236,10 @@ void BackgroundFetchDataManager::GetSettledFetchesForRegistration(
settled_fetch.response.blob_uuid = blob_handle->GetUUID();
settled_fetch.response.blob_size = request->GetFileSize();
+ // TODO(peter): Remove when we relay the real response headers.
+ settled_fetch.response.headers["Content-Length"] =
+ std::to_string(request->GetFileSize());
+
blob_handles.push_back(std::move(blob_handle));
}
}
« no previous file with comments | « no previous file | content/browser/background_fetch/background_fetch_request_info.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698