diff options
author | brettw <brettw@chromium.org> | 2015-08-11 12:30:22 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-08-11 19:31:27 +0000 |
commit | 8e2106dd88a61950569f9cfa8a94ad436d858658 (patch) | |
tree | b95818b8b8d98565bc0beaae50ffb76fa3d82080 /extensions/common/message_bundle.cc | |
parent | 7d42dad6d95bf258c721f9d15f734bb9d0af8014 (diff) | |
download | chromium_src-8e2106dd88a61950569f9cfa8a94ad436d858658.zip chromium_src-8e2106dd88a61950569f9cfa8a94ad436d858658.tar.gz chromium_src-8e2106dd88a61950569f9cfa8a94ad436d858658.tar.bz2 |
Convert remaining StringToLowerASCII to ToLowerASCII.
Remove StringToLowerASCII. This removes the template and makes a consistent call that can take a string piece.
http_response_headers.cc in HttpResponseHeaders::RemoveHeaderLine there seemed to be a bug where it did
std::string old_header_name_lowercase(name);
where it actually meant
std::string old_header_name_lowercase(old_header_name);
I fixed this.
There were a number of cases where url.host() or url.scheme() was passed to ToLowerASCII. These are already guaranteed lower-case, so I removed the call.
There were a number of cases in net that did return ToLowerASCII().c_str() when the return type is a std::string, which is unnecessary and wasteful. I removed the c_str() call.
NOPRESUBMIT=true
(for touching code with wstrings)
Review URL: https://codereview.chromium.org/1282363003
Cr-Commit-Position: refs/heads/master@{#342869}
Diffstat (limited to 'extensions/common/message_bundle.cc')
-rw-r--r-- | extensions/common/message_bundle.cc | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/extensions/common/message_bundle.cc b/extensions/common/message_bundle.cc index d71513f..2c387e1 100644 --- a/extensions/common/message_bundle.cc +++ b/extensions/common/message_bundle.cc @@ -76,7 +76,7 @@ bool MessageBundle::Init(const CatalogVector& locale_catalogs, base::DictionaryValue* catalog = (*it).get(); for (base::DictionaryValue::Iterator message_it(*catalog); !message_it.IsAtEnd(); message_it.Advance()) { - std::string key(base::StringToLowerASCII(message_it.key())); + std::string key(base::ToLowerASCII(message_it.key())); if (!IsValidName(message_it.key())) return BadKeyMessage(key, error); std::string value; @@ -191,7 +191,7 @@ bool MessageBundle::GetPlaceholders(const base::DictionaryValue& name_tree, kContentKey, name_key.c_str()); return false; } - (*placeholders)[base::StringToLowerASCII(content_key)] = content; + (*placeholders)[base::ToLowerASCII(content_key)] = content; } return true; @@ -240,7 +240,7 @@ bool MessageBundle::ReplaceVariables(const SubstitutionMap& variables, if (beg_index >= message->size()) return true; std::string::size_type end_index = - message->find(var_end_delimiter, beg_index); + message->find(var_end_delimiter, beg_index); if (end_index == message->npos) return true; @@ -249,8 +249,7 @@ bool MessageBundle::ReplaceVariables(const SubstitutionMap& variables, message->substr(beg_index, end_index - beg_index); if (!IsValidName(var_name)) continue; - SubstitutionMap::const_iterator it = - variables.find(base::StringToLowerASCII(var_name)); + auto it = variables.find(base::ToLowerASCII(var_name)); if (it == variables.end()) { *error = base::StringPrintf("Variable %s%s%s used but not defined.", var_begin_delimiter.c_str(), @@ -298,8 +297,7 @@ std::string MessageBundle::GetL10nMessage(const std::string& name) const { // static std::string MessageBundle::GetL10nMessage(const std::string& name, const SubstitutionMap& dictionary) { - SubstitutionMap::const_iterator it = - dictionary.find(base::StringToLowerASCII(name)); + auto it = dictionary.find(base::ToLowerASCII(name)); if (it != dictionary.end()) { return it->second; } |