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

Unified Diff: components/image_fetcher/core/image_data_fetcher.cc

Issue 2807143002: [Image fetcher] Add Content-Location header to image_fetcher::RequestMetadata (Closed)
Patch Set: 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 | components/image_fetcher/core/image_data_fetcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/image_fetcher/core/image_data_fetcher.cc
diff --git a/components/image_fetcher/core/image_data_fetcher.cc b/components/image_fetcher/core/image_data_fetcher.cc
index dd88027b81b379d97b2f050ed9dca0bdc9193d9e..3eac4508d217ea70e3c40c11f5add05b16514b17 100644
--- a/components/image_fetcher/core/image_data_fetcher.cc
+++ b/components/image_fetcher/core/image_data_fetcher.cc
@@ -16,6 +16,12 @@
using data_use_measurement::DataUseUserData;
+namespace {
+
+const char kContentLocationHeader[] = "Content-Location";
+
+} // namespace
+
namespace image_fetcher {
// An active image URL fetcher request. The struct contains the related requests
@@ -89,9 +95,12 @@ void ImageDataFetcher::OnURLFetchComplete(const net::URLFetcher* source) {
RequestMetadata metadata;
if (success && source->GetResponseHeaders()) {
- metadata.http_response_headers = source->GetResponseHeaders();
source->GetResponseHeaders()->GetMimeType(&metadata.mime_type);
metadata.http_response_code = source->GetResponseHeaders()->response_code();
+ // Just read the first value-pair for this header (not caring about |iter|).
+ source->GetResponseHeaders()->EnumerateHeader(
+ /*iter=*/nullptr, kContentLocationHeader,
+ &metadata.content_location_header);
success &= (metadata.http_response_code == net::HTTP_OK);
}
metadata.from_http_cache = source->WasCached();
« no previous file with comments | « no previous file | components/image_fetcher/core/image_data_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698