summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util/google_update_settings.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/installer/util/google_update_settings.cc')
-rw-r--r--chrome/installer/util/google_update_settings.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc
index 8da8adc..326a595 100644
--- a/chrome/installer/util/google_update_settings.cc
+++ b/chrome/installer/util/google_update_settings.cc
@@ -52,9 +52,15 @@ bool GoogleUpdateSettings::GetCollectStatsConsent() {
}
bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) {
- std::wstring reg_path = GetClientStateKeyPath(false);
- RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE);
- return key.WriteValue(google_update::kRegUsageStatsField, consented? 1 : 0);
+ DWORD value = consented? 1 : 0;
+ // Writing to HKLM is only a best effort deal.
+ std::wstring reg_path = GetClientStateKeyPath(true);
+ RegKey key_hklm(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ | KEY_WRITE);
+ key_hklm.WriteValue(google_update::kRegUsageStatsField, value);
+ // Writing to HKCU is used both by chrome and by the crash reporter.
+ reg_path = GetClientStateKeyPath(false);
+ RegKey key_hkcu(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE);
+ return key_hkcu.WriteValue(google_update::kRegUsageStatsField, value);
}
bool GoogleUpdateSettings::SetEULAConsent(bool consented) {