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

Side by Side Diff: components/image_fetcher/core/request_metadata.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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/image_fetcher/core/request_metadata.h" 5 #include "components/image_fetcher/core/request_metadata.h"
6 6
7 #include "net/http/http_response_headers.h"
8
9 namespace image_fetcher { 7 namespace image_fetcher {
10 8
11 namespace {
12
13 bool HttpHeadersEqual(const net::HttpResponseHeaders* lhs,
14 const net::HttpResponseHeaders* rhs) {
15 if (!lhs && !rhs) {
16 return true; // Equal if both nullptr.
17 }
18 if (!lhs || !rhs) {
19 return false; // We cannot compare the content if one of them is nullptr.
20 }
21 return lhs->raw_headers() == rhs->raw_headers();
22 }
23
24 } // namespace
25
26 RequestMetadata::RequestMetadata() 9 RequestMetadata::RequestMetadata()
27 : http_response_code(RESPONSE_CODE_INVALID), 10 : http_response_code(RESPONSE_CODE_INVALID), from_http_cache(false) {}
28 from_http_cache(false),
29 http_response_headers(nullptr) {}
30 11
31 bool operator==(const RequestMetadata& lhs, const RequestMetadata& rhs) { 12 bool operator==(const RequestMetadata& lhs, const RequestMetadata& rhs) {
32 return lhs.mime_type == rhs.mime_type && 13 return lhs.mime_type == rhs.mime_type &&
33 lhs.http_response_code == rhs.http_response_code && 14 lhs.http_response_code == rhs.http_response_code &&
34 lhs.from_http_cache == rhs.from_http_cache && 15 lhs.from_http_cache == rhs.from_http_cache &&
35 HttpHeadersEqual(lhs.http_response_headers, rhs.http_response_headers); 16 lhs.content_location_header == rhs.content_location_header;
36 } 17 }
37 18
38 bool operator!=(const RequestMetadata& lhs, const RequestMetadata& rhs) { 19 bool operator!=(const RequestMetadata& lhs, const RequestMetadata& rhs) {
39 return !(lhs == rhs); 20 return !(lhs == rhs);
40 } 21 }
41 22
42 } // namespace image_fetcher 23 } // namespace image_fetcher
OLDNEW
« no previous file with comments | « components/image_fetcher/core/request_metadata.h ('k') | components/image_fetcher/core/request_metadata_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698