diff options
Diffstat (limited to 'chrome/installer/util/google_update_settings.cc')
-rw-r--r-- | chrome/installer/util/google_update_settings.cc | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc index 326a595..cbd887d 100644 --- a/chrome/installer/util/google_update_settings.cc +++ b/chrome/installer/util/google_update_settings.cc @@ -1,25 +1,18 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/installer/util/google_update_settings.h" #include "base/registry.h" +#include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/google_update_constants.h" namespace { -std::wstring GetClientStateKeyPath(const bool use_medium_key) { - std::wstring reg_path(use_medium_key ? - google_update::kRegPathClientStateMedium : - google_update::kRegPathClientState); - reg_path.append(L"\\"); - reg_path.append(google_update::kChromeGuid); - return reg_path; -} - bool ReadGoogleUpdateStrKey(const wchar_t* const name, std::wstring* value) { - std::wstring reg_path = GetClientStateKeyPath(false); + BrowserDistribution* dist = BrowserDistribution::GetDistribution(); + std::wstring reg_path = dist->GetStateKey(); RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ); if (!key.ReadValue(name, value)) { RegKey hklm_key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ); @@ -29,7 +22,8 @@ bool ReadGoogleUpdateStrKey(const wchar_t* const name, std::wstring* value) { } bool ClearGoogleUpdateStrKey(const wchar_t* const name) { - std::wstring reg_path = GetClientStateKeyPath(false); + BrowserDistribution* dist = BrowserDistribution::GetDistribution(); + std::wstring reg_path = dist->GetStateKey(); RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE); std::wstring value; if (!key.ReadValue(name, &value)) @@ -40,7 +34,8 @@ bool ClearGoogleUpdateStrKey(const wchar_t* const name) { } // namespace. bool GoogleUpdateSettings::GetCollectStatsConsent() { - std::wstring reg_path = GetClientStateKeyPath(false); + BrowserDistribution* dist = BrowserDistribution::GetDistribution(); + std::wstring reg_path = dist->GetStateKey(); RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ); DWORD value; if (!key.ReadValueDW(google_update::kRegUsageStatsField, &value)) { @@ -54,17 +49,19 @@ bool GoogleUpdateSettings::GetCollectStatsConsent() { bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { DWORD value = consented? 1 : 0; // Writing to HKLM is only a best effort deal. - std::wstring reg_path = GetClientStateKeyPath(true); + BrowserDistribution* dist = BrowserDistribution::GetDistribution(); + std::wstring reg_path = dist->GetStateMediumKey(); 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); + reg_path = dist->GetStateKey(); 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) { - std::wstring reg_path = GetClientStateKeyPath(true); + BrowserDistribution* dist = BrowserDistribution::GetDistribution(); + std::wstring reg_path = dist->GetStateMediumKey(); RegKey key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ | KEY_SET_VALUE); return key.WriteValue(google_update::kRegEULAAceptedField, consented? 1 : 0); } |