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

Unified Diff: chrome/installer/util/google_update_settings.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: robertshield nits Created 7 years, 11 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
Index: chrome/installer/util/google_update_settings.cc
diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc
index 1520577cded507e9927de846213884046efb89b4..a53b61e0c6e9b9ac312e929331ff8883c397acd6 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;
+}

Powered by Google App Engine
This is Rietveld 408576698