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: nits addressed 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
« no previous file with comments | « chrome/installer/util/install_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..6c4112b6fbc6d23a7717efe1ab4256c69e9306f4 100644
--- a/chrome/installer/util/install_util.cc
+++ b/chrome/installer/util/install_util.cc
@@ -38,6 +38,13 @@ using installer::ProductState;
namespace {
+const wchar_t* kExperimentAppGuids[] = {
+ L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}",
grt (UTC plus 2) 2012/11/20 16:05:46 this is the binaries' app guid. what does it have
SteveT 2012/11/20 23:23:50 To be honest, I do not know why this is here. I ca
grt (UTC plus 2) 2012/11/21 20:14:18 sgtm
+ L"{8A69D345-D564-463C-AFF1-A69D9E530F96}",
grt (UTC plus 2) 2012/11/20 16:05:46 this is Chrome's app guid.
SteveT 2012/11/20 23:23:50 Yes, and when I am done refactoring this code and
+};
+
+const wchar_t kExperimentLabels[] = L"experiment_labels";
+
const wchar_t kStageBinaryPatching[] = L"binary_patching";
const wchar_t kStageBuilding[] = L"building";
const wchar_t kStageConfiguringAutoLaunch[] = L"configuring_auto_launch";
@@ -523,6 +530,27 @@ string16 InstallUtil::GetCurrentDate() {
return string16(date_str, len);
}
+// static
+bool InstallUtil::SetOmahaExperimentLabel(const string16& experiment_label,
grt (UTC plus 2) 2012/11/20 16:05:46 this should only exist and/or do anything useful f
SteveT 2012/11/20 23:23:50 Google Chrome and gcapi builds, from what I unders
grt (UTC plus 2) 2012/11/21 20:14:18 I think the contents of this should likely be ifde
SteveT 2012/11/21 23:19:26 Well we want this to run in the GCAPI DLL... is th
+ HKEY registry_hive) {
+ int successful_writes = 0;
+ for (int i = 0; i < arraysize(kExperimentAppGuids); ++i) {
grt (UTC plus 2) 2012/11/20 16:05:46 int -> size_t (arraysize returns a size_t) here an
SteveT 2012/11/20 23:23:50 Done.
+ string16 experiment_path(google_update::kRegPathClientState);
grt (UTC plus 2) 2012/11/20 16:05:46 move this instance out of the loop and just assign
SteveT 2012/11/20 23:23:50 Done.
+ experiment_path += L"\\";
+ experiment_path += kExperimentAppGuids[i];
+
+ RegKey client_state(registry_hive, experiment_path.c_str(),
grt (UTC plus 2) 2012/11/20 16:05:46 this will create the key if it doesn't exist. is
SteveT 2012/11/20 23:23:50 Yes, I believe that is the case. In fact, this who
grt (UTC plus 2) 2012/11/21 20:14:18 Fortunately, this is not the case. If it were, thi
SteveT 2012/11/21 23:19:26 This is meant to be a dumb "write to (and over) th
SteveT 2012/11/21 23:19:26 Sorry, when I said clobbers the Key, I meant it cl
+ KEY_SET_VALUE);
+ if (client_state.Valid() &&
grt (UTC plus 2) 2012/11/20 16:05:46 this check isn't needed
SteveT 2012/11/20 23:23:50 Done.
+ client_state.WriteValue(kExperimentLabels,
+ experiment_label.c_str()) == ERROR_SUCCESS) {
+ successful_writes++;
grt (UTC plus 2) 2012/11/20 16:05:46 prefer preincrement
SteveT 2012/11/20 23:23:50 Done.
+ }
+ }
+
+ return (successful_writes == arraysize(kExperimentAppGuids));
+}
+
// Open |path| with minimal access to obtain information about it, returning
// true and populating |handle| on success.
// static
« no previous file with comments | « chrome/installer/util/install_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698