OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/common/variations/experiment_labels.h" | 5 #include "chrome/common/variations/experiment_labels.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 non_variation_labels += *it; | 89 non_variation_labels += *it; |
90 } | 90 } |
91 | 91 |
92 return non_variation_labels; | 92 return non_variation_labels; |
93 } | 93 } |
94 | 94 |
95 base::string16 CombineExperimentLabels(const base::string16& variation_labels, | 95 base::string16 CombineExperimentLabels(const base::string16& variation_labels, |
96 const base::string16& other_labels) { | 96 const base::string16& other_labels) { |
97 const base::string16 separator(1, google_update::kExperimentLabelSeparator); | 97 const base::string16 separator(1, google_update::kExperimentLabelSeparator); |
98 DCHECK(!base::StartsWith(variation_labels, separator, false)); | 98 DCHECK(!base::StartsWith(variation_labels, separator, false)); |
99 DCHECK(!EndsWith(variation_labels, separator, false)); | 99 DCHECK(!base::EndsWith(variation_labels, separator, false)); |
100 DCHECK(!base::StartsWith(other_labels, separator, false)); | 100 DCHECK(!base::StartsWith(other_labels, separator, false)); |
101 DCHECK(!EndsWith(other_labels, separator, false)); | 101 DCHECK(!base::EndsWith(other_labels, separator, false)); |
102 // Note that if either label is empty, a separator is not necessary. | 102 // Note that if either label is empty, a separator is not necessary. |
103 base::string16 combined_labels = other_labels; | 103 base::string16 combined_labels = other_labels; |
104 if (!other_labels.empty() && !variation_labels.empty()) | 104 if (!other_labels.empty() && !variation_labels.empty()) |
105 combined_labels += google_update::kExperimentLabelSeparator; | 105 combined_labels += google_update::kExperimentLabelSeparator; |
106 combined_labels += variation_labels; | 106 combined_labels += variation_labels; |
107 return combined_labels; | 107 return combined_labels; |
108 } | 108 } |
109 | 109 |
110 } // namespace chrome_variations | 110 } // namespace chrome_variations |
OLD | NEW |