Chromium Code Reviews| Index: extensions/browser/api/web_request/web_request_api_helpers.cc |
| diff --git a/extensions/browser/api/web_request/web_request_api_helpers.cc b/extensions/browser/api/web_request/web_request_api_helpers.cc |
| index fae5cdc212e2a38edaad011de1ad44b86ea16ee9..35060deaa6f62213b62887da7f36190369014950 100644 |
| --- a/extensions/browser/api/web_request/web_request_api_helpers.cc |
| +++ b/extensions/browser/api/web_request/web_request_api_helpers.cc |
| @@ -361,17 +361,21 @@ EventResponseDelta* CalculateOnHeadersReceivedDelta( |
| // Find added headers (header keys are treated case insensitively). |
| { |
| - for (ResponseHeaders::const_iterator i = new_response_headers->begin(); |
| - i != new_response_headers->end(); ++i) { |
| - void* iter = NULL; |
| + for (const auto& i : *new_response_headers) { |
| + std::string name_lowercase = base::ToLowerASCII(i.first); |
| + void* iter = nullptr; |
|
not at google - send to devlin
2015/09/08 22:55:34
I presume you don't need |iter| for anything?
robwu
2015/09/08 23:00:21
iter is just used to keep track of the header iter
|
| + std::string name; |
| std::string value; |
| bool header_found = false; |
| - while (old_response_headers->EnumerateHeader(&iter, i->first, &value) && |
| - !header_found) { |
| - header_found = (value == i->second); |
| + while (old_response_headers->EnumerateHeaderLines(&iter, &name, &value)) { |
| + if (base::LowerCaseEqualsASCII(name, name_lowercase) && |
|
not at google - send to devlin
2015/09/08 22:55:34
Seems like you could use EqualsCaseInsensitiveASCI
robwu
2015/09/08 23:00:20
Possibly, but transforming once to lowercase and s
|
| + value == i.second) { |
| + header_found = true; |
| + break; |
| + } |
| } |
| if (!header_found) |
| - result->added_response_headers.push_back(*i); |
| + result->added_response_headers.push_back(i); |
| } |
| } |