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

Unified Diff: components/variations/net/variations_http_header_provider.cc

Issue 1234973004: Update SplitString calls in components (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixes Created 5 years, 5 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
Index: components/variations/net/variations_http_header_provider.cc
diff --git a/components/variations/net/variations_http_header_provider.cc b/components/variations/net/variations_http_header_provider.cc
index f94ad2c953a126c38368cb6195b860ae94a7e988..ff8fd201041f710975cb66fccfffd55c668b3b01 100644
--- a/components/variations/net/variations_http_header_provider.cc
+++ b/components/variations/net/variations_http_header_provider.cc
@@ -88,21 +88,20 @@ bool VariationsHttpHeaderProvider::SetDefaultVariationIds(
const std::string& variation_ids) {
default_variation_ids_set_.clear();
default_trigger_id_set_.clear();
- std::vector<std::string> entries;
- base::SplitString(variation_ids, ',', &entries);
- for (std::vector<std::string>::const_iterator it = entries.begin();
- it != entries.end(); ++it) {
- if (it->empty()) {
+ for (const base::StringPiece& entry : base::SplitStringPiece(
+ variation_ids, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL)) {
+ if (entry.empty()) {
default_variation_ids_set_.clear();
default_trigger_id_set_.clear();
return false;
}
- bool trigger_id = base::StartsWith(*it, "t", base::CompareCase::SENSITIVE);
+ bool trigger_id =
+ base::StartsWith(entry, "t", base::CompareCase::SENSITIVE);
// Remove the "t" prefix if it's there.
- std::string entry = trigger_id ? it->substr(1) : *it;
+ base::StringPiece trimmed_entry = trigger_id ? entry.substr(1) : entry;
int variation_id = 0;
- if (!base::StringToInt(entry, &variation_id)) {
+ if (!base::StringToInt(trimmed_entry, &variation_id)) {
default_variation_ids_set_.clear();
default_trigger_id_set_.clear();
return false;

Powered by Google App Engine
This is Rietveld 408576698