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

Side by Side Diff: chrome/installer/gcapi/gcapi_omaha_experiment.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/installer/gcapi/gcapi_omaha_experiment.h" 5 #include "chrome/installer/gcapi/gcapi_omaha_experiment.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/strings/string_split.h" 8 #include "base/strings/string_split.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 25 matching lines...) Expand all
36 const bool system_level = shell_mode == GCAPI_INVOKED_UAC_ELEVATION; 36 const bool system_level = shell_mode == GCAPI_INVOKED_UAC_ELEVATION;
37 37
38 base::string16 original_labels; 38 base::string16 original_labels;
39 if (!GoogleUpdateSettings::ReadExperimentLabels(system_level, 39 if (!GoogleUpdateSettings::ReadExperimentLabels(system_level,
40 &original_labels)) { 40 &original_labels)) {
41 return false; 41 return false;
42 } 42 }
43 43
44 // Split the original labels by the label separator. 44 // Split the original labels by the label separator.
45 std::vector<base::string16> entries; 45 std::vector<base::string16> entries;
46 base::SplitStringUsingSubstr( 46 base::SplitString(original_labels, google_update::kExperimentLabelSeparator,
47 original_labels, 47 &entries);
48 base::ASCIIToUTF16(google_update::kExperimentLabelSep),
49 &entries);
50 48
51 // Keep all labels, but the one we want to add/replace. 49 // Keep all labels, but the one we want to add/replace.
52 base::string16 new_labels; 50 base::string16 new_labels;
53 for (std::vector<base::string16>::const_iterator it = entries.begin(); 51 for (std::vector<base::string16>::const_iterator it = entries.begin();
54 it != entries.end(); ++it) { 52 it != entries.end(); ++it) {
55 if (!it->empty() && !StartsWith(*it, label + L"=", true)) { 53 if (!it->empty() && !StartsWith(*it, label + L"=", true)) {
56 new_labels += *it; 54 new_labels += *it;
57 new_labels += base::ASCIIToUTF16(google_update::kExperimentLabelSep); 55 new_labels += google_update::kExperimentLabelSeparator;
58 } 56 }
59 } 57 }
60 58
61 new_labels.append( 59 new_labels.append(
62 gcapi_internals::GetGCAPIExperimentLabel(brand_code, label)); 60 gcapi_internals::GetGCAPIExperimentLabel(brand_code, label));
63 61
64 return GoogleUpdateSettings::SetExperimentLabels(system_level, 62 return GoogleUpdateSettings::SetExperimentLabels(system_level,
65 new_labels); 63 new_labels);
66 } 64 }
67 65
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 bool SetReactivationExperimentLabels(const wchar_t* brand_code, 97 bool SetReactivationExperimentLabels(const wchar_t* brand_code,
100 int shell_mode) { 98 int shell_mode) {
101 return SetExperimentLabel(brand_code, gcapi_internals::kReactivationLabel, 99 return SetExperimentLabel(brand_code, gcapi_internals::kReactivationLabel,
102 shell_mode); 100 shell_mode);
103 } 101 }
104 102
105 bool SetRelaunchExperimentLabels(const wchar_t* brand_code, int shell_mode) { 103 bool SetRelaunchExperimentLabels(const wchar_t* brand_code, int shell_mode) {
106 return SetExperimentLabel(brand_code, gcapi_internals::kRelaunchLabel, 104 return SetExperimentLabel(brand_code, gcapi_internals::kRelaunchLabel,
107 shell_mode); 105 shell_mode);
108 } 106 }
OLDNEW
« no previous file with comments | « chrome/common/variations/experiment_labels.cc ('k') | chrome/installer/gcapi/gcapi_omaha_experiment_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698