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

Unified Diff: components/auto_login_parser/auto_login_parser.cc

Issue 545193008: Use base::StringPairs where appropriate from /components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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/autofill/content/browser/wallet/wallet_client_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/auto_login_parser/auto_login_parser.cc
diff --git a/components/auto_login_parser/auto_login_parser.cc b/components/auto_login_parser/auto_login_parser.cc
index 298c9b7acf33728b1e29779b836ca36f11c410ba..38fc633c8183e974e2ceb75a76498eff808a49bd 100644
--- a/components/auto_login_parser/auto_login_parser.cc
+++ b/components/auto_login_parser/auto_login_parser.cc
@@ -44,23 +44,25 @@ bool ParseHeader(const std::string& header,
if (header.empty())
return false;
- std::vector<std::pair<std::string, std::string> > pairs;
+ base::StringPairs pairs;
if (!base::SplitStringIntoKeyValuePairs(header, '=', '&', &pairs))
return false;
// Parse the information from the |header| string.
HeaderData local_params;
- for (size_t i = 0; i < pairs.size(); ++i) {
- const std::pair<std::string, std::string>& pair = pairs[i];
- std::string unescaped_value(net::UnescapeURLComponent(
- pair.second, net::UnescapeRule::URL_SPECIAL_CHARS));
- if (pair.first == "realm") {
+ for (base::StringPairs::const_iterator it = pairs.begin(); it != pairs.end();
+ ++it) {
+ const std::string& key = it->first;
+ const std::string& value = it->second;
+ std::string unescaped_value(
+ net::UnescapeURLComponent(value, net::UnescapeRule::URL_SPECIAL_CHARS));
+ if (key == "realm") {
if (!MatchRealm(unescaped_value, realm_restriction))
return false;
local_params.realm = unescaped_value;
- } else if (pair.first == "account") {
+ } else if (key == "account") {
local_params.account = unescaped_value;
- } else if (pair.first == "args") {
+ } else if (key == "args") {
local_params.args = unescaped_value;
}
}
« no previous file with comments | « no previous file | components/autofill/content/browser/wallet/wallet_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698