diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-31 16:15:38 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-31 16:15:38 +0000 |
commit | e27022f2a07acc7df33f60c5e600906977b1dd17 (patch) | |
tree | 362eb589b0b2e88e9758a29f12c1528d2eb17ddc /chrome/installer | |
parent | 1e314cf0de24d58991e66f8d66e09e6cb1454770 (diff) | |
download | chromium_src-e27022f2a07acc7df33f60c5e600906977b1dd17.zip chromium_src-e27022f2a07acc7df33f60c5e600906977b1dd17.tar.gz chromium_src-e27022f2a07acc7df33f60c5e600906977b1dd17.tar.bz2 |
Consolidate same constant defined in three different places. No change in chrome.exe size.
Review URL: http://codereview.chromium.org/8409
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4284 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r-- | chrome/installer/util/google_chrome_distribution.cc | 6 | ||||
-rw-r--r-- | chrome/installer/util/google_update_constants.cc | 12 | ||||
-rw-r--r-- | chrome/installer/util/google_update_constants.h | 18 | ||||
-rw-r--r-- | chrome/installer/util/google_update_settings.cc | 47 |
4 files changed, 49 insertions, 34 deletions
diff --git a/chrome/installer/util/google_chrome_distribution.cc b/chrome/installer/util/google_chrome_distribution.cc index ceeac44..e711c95 100644 --- a/chrome/installer/util/google_chrome_distribution.cc +++ b/chrome/installer/util/google_chrome_distribution.cc @@ -160,7 +160,7 @@ void GoogleChromeDistribution::UpdateDiffInstallStatus(bool system_install, reg_key.append(L"\\"); reg_key.append(google_update::kChromeGuid); if (!key.Open(reg_root, reg_key.c_str(), KEY_ALL_ACCESS) || - !key.ReadValue(google_update::kRegApFieldName, &ap_key_value)) { + !key.ReadValue(google_update::kRegApField, &ap_key_value)) { LOG(INFO) << "Application key not found."; if (!incremental_install || !GetInstallReturnCode(install_status)) { LOG(INFO) << "Returning without changing application key."; @@ -180,9 +180,9 @@ void GoogleChromeDistribution::UpdateDiffInstallStatus(bool system_install, std::wstring new_value = GoogleChromeDistribution::GetNewGoogleUpdateApKey( incremental_install, install_status, ap_key_value); if ((new_value.compare(ap_key_value) != 0) && - !key.WriteValue(google_update::kRegApFieldName, new_value.c_str())) { + !key.WriteValue(google_update::kRegApField, new_value.c_str())) { LOG(ERROR) << "Failed to write value " << new_value - << " to the registry field " << google_update::kRegApFieldName; + << " to the registry field " << google_update::kRegApField; } key.Close(); } diff --git a/chrome/installer/util/google_update_constants.cc b/chrome/installer/util/google_update_constants.cc index 6703850..ee75f0c 100644 --- a/chrome/installer/util/google_update_constants.cc +++ b/chrome/installer/util/google_update_constants.cc @@ -8,12 +8,18 @@ namespace google_update { const wchar_t kChromeGuid[] = L"{8A69D345-D564-463c-AFF1-A69D9E530F96}"; const wchar_t kGearsUpgradeCode[] = L"{D92DBAED-3E3E-4530-B30D-072D16C7DDD0}"; + const wchar_t kRegPathClients[] = L"Software\\Google\\Update\\Clients"; const wchar_t kRegPathClientState[] = L"Software\\Google\\Update\\ClientState"; -const wchar_t kRegApFieldName[] = L"ap"; + +const wchar_t kRegApField[] = L"ap"; +const wchar_t kRegBrowserField[] = L"browser"; +const wchar_t kRegDidRunField[] = L"dr"; +const wchar_t kRegLangField[] = L"lang"; +const wchar_t kRegLastCheckedField[] = L"LastChecked"; const wchar_t kRegNameField[] = L"name"; +const wchar_t kRegRLZBrandField[] = L"brand"; +const wchar_t kRegUsageStatsField[] = L"usagestats"; const wchar_t kRegVersionField[] = L"pv"; -const wchar_t kRegLastCheckedField[] = L"LastChecked"; - } // namespace installer diff --git a/chrome/installer/util/google_update_constants.h b/chrome/installer/util/google_update_constants.h index 00a09ad..2b24540 100644 --- a/chrome/installer/util/google_update_constants.h +++ b/chrome/installer/util/google_update_constants.h @@ -4,25 +4,29 @@ // Defines all the command-line switches used with Google Update. -#ifndef CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_CONSTANTS_H__ -#define CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_CONSTANTS_H__ +#ifndef CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_CONSTANTS_H_ +#define CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_CONSTANTS_H_ namespace google_update { extern const wchar_t kChromeGuid[]; - // Strictly speaking Google Update doesn't care about this GUID but it is still // related to install as it is used by MSI to identify Gears. extern const wchar_t kGearsUpgradeCode[]; extern const wchar_t kRegPathClients[]; extern const wchar_t kRegPathClientState[]; -extern const wchar_t kRegApFieldName[]; + +extern const wchar_t kRegApField[]; +extern const wchar_t kRegBrowserField[]; +extern const wchar_t kRegDidRunField[]; +extern const wchar_t kRegLangField[]; +extern const wchar_t kRegLastCheckedField[]; extern const wchar_t kRegNameField[]; +extern const wchar_t kRegRLZBrandField[]; +extern const wchar_t kRegUsageStatsField[]; extern const wchar_t kRegVersionField[]; -extern const wchar_t kRegLastCheckedField[]; - } // namespace google_update -#endif // CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_CONSTANTS_H__ +#endif // CHROME_INSTALLER_UTIL_GOOGLE_UPDATE_CONSTANTS_H_ diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc index 91feefe..859ca02 100644 --- a/chrome/installer/util/google_update_settings.cc +++ b/chrome/installer/util/google_update_settings.cc @@ -5,44 +5,49 @@ #include "chrome/installer/util/google_update_settings.h" #include "base/registry.h" - -namespace { - -const wchar_t kRegistryBase[] = - L"Software\\Google\\Update\\ClientState\\{8A69D345-D564-463c-AFF1-A69D9E530F96}"; -const wchar_t kUsageStatsFlag[] = L"usagestats"; -const wchar_t kBrowserUsed[] = L"browser"; -const wchar_t kSelectedLang[] = L"lang"; -const wchar_t kRLZBrand[] = L"brand"; - -} // namespace +#include "chrome/installer/util/google_update_constants.h" bool GoogleUpdateSettings::GetCollectStatsConsent() { - RegKey key(HKEY_CURRENT_USER, kRegistryBase, KEY_READ); + std::wstring reg_path(google_update::kRegPathClientState); + reg_path.append(L"\\"); + reg_path.append(google_update::kChromeGuid); + RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ); DWORD value; - if (!key.ReadValueDW(kUsageStatsFlag, &value)) + if (!key.ReadValueDW(google_update::kRegUsageStatsField, &value)) return false; return (1 == value); } bool GoogleUpdateSettings::SetCollectStatsConsent(bool consented) { - RegKey key(HKEY_CURRENT_USER, kRegistryBase, KEY_READ | KEY_WRITE); + std::wstring reg_path(google_update::kRegPathClientState); + reg_path.append(L"\\"); + reg_path.append(google_update::kChromeGuid); + RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE); DWORD value = consented ? 1 : 0; - return key.WriteValue(kUsageStatsFlag, value); + return key.WriteValue(google_update::kRegUsageStatsField, value); } bool GoogleUpdateSettings::GetBrowser(std::wstring* browser) { - RegKey key(HKEY_CURRENT_USER, kRegistryBase, KEY_READ); - return key.ReadValue(kBrowserUsed, browser); + std::wstring reg_path(google_update::kRegPathClientState); + reg_path.append(L"\\"); + reg_path.append(google_update::kChromeGuid); + RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ); + return key.ReadValue(google_update::kRegBrowserField, browser); } bool GoogleUpdateSettings::GetLanguage(std::wstring* language) { - RegKey key(HKEY_CURRENT_USER, kRegistryBase, KEY_READ); - return key.ReadValue(kSelectedLang, language); + std::wstring reg_path(google_update::kRegPathClientState); + reg_path.append(L"\\"); + reg_path.append(google_update::kChromeGuid); + RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ); + return key.ReadValue(google_update::kRegLangField, language); } bool GoogleUpdateSettings::GetBrand(std::wstring* brand) { - RegKey key(HKEY_CURRENT_USER, kRegistryBase, KEY_READ); - return key.ReadValue(kRLZBrand, brand); + std::wstring reg_path(google_update::kRegPathClientState); + reg_path.append(L"\\"); + reg_path.append(google_update::kChromeGuid); + RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ); + return key.ReadValue(google_update::kRegRLZBrandField, brand); } |