diff options
author | stevet@chromium.org <stevet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-09 02:13:13 +0000 |
---|---|---|
committer | stevet@chromium.org <stevet@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-09 02:13:13 +0000 |
commit | 7205c6eb4ecec305e33cdc1d1eb90fdb37407264 (patch) | |
tree | b83c859b0d8c18fc1e0eed9e1b4e0c8e5bdac9b0 /chrome/installer/util/google_update_settings.cc | |
parent | 7363a623e3a95c92173e99aa2b09f2dbe828d9fd (diff) | |
download | chromium_src-7205c6eb4ecec305e33cdc1d1eb90fdb37407264.zip chromium_src-7205c6eb4ecec305e33cdc1d1eb90fdb37407264.tar.gz chromium_src-7205c6eb4ecec305e33cdc1d1eb90fdb37407264.tar.bz2 |
Refactor SetOmahaExperimentLabel out of gcpai and into install_util.
Change the method to no longer write to both App GUIDs, just the one that matches the distribution of the caller. This means that GCAPI will only write to the Google Chrome product's client state key, and not to the Chrome Binaries.
Replace SetOmahaExperimentLabel in the GCAPI code with a more specific version, and have SetOmahaExperimentLabel perform the general clobber-write to the registry.
This is in preparation for future work in using the experiment_labels to transmit Chrome Variations.
BUG=160251
Review URL: https://chromiumcodereview.appspot.com/11280067
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@175671 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer/util/google_update_settings.cc')
-rw-r--r-- | chrome/installer/util/google_update_settings.cc | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc index 1520577..a53b61e 100644 --- a/chrome/installer/util/google_update_settings.cc +++ b/chrome/installer/util/google_update_settings.cc @@ -642,3 +642,29 @@ bool GoogleUpdateSettings::GetUpdateDetail(bool system_install, dist->GetAppGuid().c_str(), data); } + +bool GoogleUpdateSettings::SetExperimentLabels( + bool system_install, + const string16& experiment_labels) { + HKEY reg_root = system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER; + + // Use the browser distribution and install level to write to the correct + // client state/app guid key. + bool success = false; + BrowserDistribution* dist = BrowserDistribution::GetDistribution(); + if (dist->ShouldSetExperimentLabels()) { + string16 client_state_path( + system_install ? dist->GetStateMediumKey() : dist->GetStateKey()); + RegKey client_state( + reg_root, client_state_path.c_str(), KEY_SET_VALUE); + if (experiment_labels.empty()) { + success = client_state.DeleteValue(google_update::kExperimentLabels) + == ERROR_SUCCESS; + } else { + success = client_state.WriteValue(google_update::kExperimentLabels, + experiment_labels.c_str()) == ERROR_SUCCESS; + } + } + + return success; +} |