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

Unified Diff: chrome/installer/util/install_util.cc

Issue 11280067: Refactor SetOmahaExperimentLabel out of gcpai and into install_util. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Init Created 8 years, 1 month 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: chrome/installer/util/install_util.cc
diff --git a/chrome/installer/util/install_util.cc b/chrome/installer/util/install_util.cc
index db710d47d9f85fb116098574e5d5bca6a9f4be7f..7ed64154c5d46f895cec00751ee1245402d1c43a 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -118,6 +118,13 @@ HWND CreateUACForegroundWindow() {
return foreground_window;
}
+const wchar_t kExperimentLabels[] = L"experiment_labels";
+
+const wchar_t* kExperimentAppGuids[] = {
+ L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}",
+ L"{8A69D345-D564-463C-AFF1-A69D9E530F96}",
+};
robertshield 2012/11/20 15:29:49 move these up next to the other constants
SteveT 2012/11/20 15:45:01 Moved them up in alpha order as well. Thanks. Done
+
} // namespace
string16 InstallUtil::GetActiveSetupPath(BrowserDistribution* dist) {
@@ -523,6 +530,28 @@ string16 InstallUtil::GetCurrentDate() {
return string16(date_str, len);
}
+// static
+bool InstallUtil::SetOmahaExperimentLabel(const string16& experiment_label,
+ HKEY registry_hive) {
+ int successful_writes = 0;
+ for (int i = 0; i < arraysize(kExperimentAppGuids); ++i) {
+ string16 experiment_path(google_update::kRegPathClientState);
+ experiment_path += L"\\";
+ experiment_path += kExperimentAppGuids[i];
+
+ RegKey client_state(registry_hive, experiment_path.c_str(),
+ KEY_SET_VALUE);
+ if (client_state.Valid()) {
+ if (client_state.WriteValue(kExperimentLabels,
+ experiment_label.c_str()) == ERROR_SUCCESS) {
robertshield 2012/11/20 15:29:49 nit: collapse this to a single if to reduce indent
SteveT 2012/11/20 15:45:01 Done.
+ successful_writes++;
+ }
+ }
+ }
+
+ return (successful_writes == arraysize(kExperimentAppGuids));
+}
+
// Open |path| with minimal access to obtain information about it, returning
// true and populating |handle| on success.
// static
« chrome/installer/gcapi/gcapi_omaha_experiment.cc ('K') | « chrome/installer/util/install_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698