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

Unified Diff: chrome/common/variations/experiment_labels.cc

Issue 291653007: Cleanup, mostly replacing uses of SplitStringUsingSubstr() with SplitString(), (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | « chrome/browser/prerender/prerender_field_trial.cc ('k') | chrome/installer/gcapi/gcapi_omaha_experiment.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/variations/experiment_labels.cc
diff --git a/chrome/common/variations/experiment_labels.cc b/chrome/common/variations/experiment_labels.cc
index 10294d89a8961d1bd93e2c3be194d1b17457aad7..7d101bd5fb0f06a9379b295e6d692daaaf58c0dc 100644
--- a/chrome/common/variations/experiment_labels.cc
+++ b/chrome/common/variations/experiment_labels.cc
@@ -58,10 +58,8 @@ base::string16 BuildGoogleUpdateExperimentLabel(
if (id == EMPTY_ID)
continue;
- if (!experiment_labels.empty()) {
- experiment_labels +=
- base::ASCIIToUTF16(google_update::kExperimentLabelSep);
- }
+ if (!experiment_labels.empty())
+ experiment_labels += google_update::kExperimentLabelSeparator;
experiment_labels += CreateSingleExperimentLabel(++counter, id,
current_time);
}
@@ -70,15 +68,12 @@ base::string16 BuildGoogleUpdateExperimentLabel(
}
base::string16 ExtractNonVariationLabels(const base::string16& labels) {
- const base::string16 separator =
- base::ASCIIToUTF16(google_update::kExperimentLabelSep);
- base::string16 non_variation_labels;
-
// First, split everything by the label separator.
std::vector<base::string16> entries;
- base::SplitStringUsingSubstr(labels, separator, &entries);
+ base::SplitString(labels, google_update::kExperimentLabelSeparator, &entries);
// For each label, keep the ones that do not look like a Variations label.
+ base::string16 non_variation_labels;
for (std::vector<base::string16>::const_iterator it = entries.begin();
it != entries.end(); ++it) {
if (it->empty() ||
@@ -88,7 +83,7 @@ base::string16 ExtractNonVariationLabels(const base::string16& labels) {
// Dump the whole thing, including the timestamp.
if (!non_variation_labels.empty())
- non_variation_labels += separator;
+ non_variation_labels += google_update::kExperimentLabelSeparator;
non_variation_labels += *it;
}
@@ -97,8 +92,7 @@ base::string16 ExtractNonVariationLabels(const base::string16& labels) {
base::string16 CombineExperimentLabels(const base::string16& variation_labels,
const base::string16& other_labels) {
- const base::string16 separator =
- base::ASCIIToUTF16(google_update::kExperimentLabelSep);
+ const base::string16 separator(1, google_update::kExperimentLabelSeparator);
DCHECK(!StartsWith(variation_labels, separator, false));
DCHECK(!EndsWith(variation_labels, separator, false));
DCHECK(!StartsWith(other_labels, separator, false));
@@ -106,7 +100,7 @@ base::string16 CombineExperimentLabels(const base::string16& variation_labels,
// Note that if either label is empty, a separator is not necessary.
base::string16 combined_labels = other_labels;
if (!other_labels.empty() && !variation_labels.empty())
- combined_labels += separator;
+ combined_labels += google_update::kExperimentLabelSeparator;
combined_labels += variation_labels;
return combined_labels;
}
« no previous file with comments | « chrome/browser/prerender/prerender_field_trial.cc ('k') | chrome/installer/gcapi/gcapi_omaha_experiment.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698