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

Unified Diff: chrome/installer/gcapi/gcapi_omaha_experiment.cc

Issue 9465013: Mike's change. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing Roger's feedback. Created 8 years, 10 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/installer/gcapi/gcapi_omaha_experiment.h ('k') | chrome/installer/gcapi/gcapi_reactivation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/gcapi/gcapi_omaha_experiment.cc
diff --git a/chrome/installer/gcapi/gcapi_omaha_experiment.cc b/chrome/installer/gcapi/gcapi_omaha_experiment.cc
index 539bd6f13cf697f49f3f6574e92c352705cfa718..6b4b94e74a2a951894aa6721a8bc9cf683670118 100644
--- a/chrome/installer/gcapi/gcapi_omaha_experiment.cc
+++ b/chrome/installer/gcapi/gcapi_omaha_experiment.cc
@@ -11,6 +11,7 @@
#include "base/win/registry.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
+#include "chrome/installer/gcapi/gcapi.h"
using base::Time;
using base::TimeDelta;
@@ -73,18 +74,25 @@ int GetCurrentRlzWeek() {
} // namespace
-bool SetOmahaExperimentLabel(const wchar_t* brand_code) {
+bool SetOmahaExperimentLabel(const wchar_t* brand_code, int shell_mode) {
if (!brand_code) {
return false;
}
+ // When this function is invoked in standard, non-elevated shell, we default
+ // to writing the experiment label to HKCU. When it is invoked in a UAC-
+ // elevated shell, we write the experiment label to HKLM.
+ HKEY registry_hive =
+ shell_mode == GCAPI_INVOKED_UAC_ELEVATION ? HKEY_LOCAL_MACHINE :
+ HKEY_CURRENT_USER;
+
int week_number = GetCurrentRlzWeek();
if (week_number < 0 || week_number > 999)
week_number = 999;
string16 experiment_label;
base::SStringPrintf(&experiment_label,
- L"%ls_%d|%ls",
+ L"reacbrand=%ls_%d|%ls",
brand_code,
week_number,
BuildOmahaExperimentDateString().c_str());
@@ -95,7 +103,7 @@ bool SetOmahaExperimentLabel(const wchar_t* brand_code) {
experiment_path += L"\\";
experiment_path += kExperimentAppGuids[i];
- RegKey client_state(HKEY_LOCAL_MACHINE, experiment_path.c_str(),
+ RegKey client_state(registry_hive, experiment_path.c_str(),
KEY_SET_VALUE);
if (client_state.Valid()) {
if (client_state.WriteValue(kExperimentLabels,
« no previous file with comments | « chrome/installer/gcapi/gcapi_omaha_experiment.h ('k') | chrome/installer/gcapi/gcapi_reactivation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698