diff options
author | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-07 22:30:09 +0000 |
---|---|---|
committer | cpu@google.com <cpu@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-07 22:30:09 +0000 |
commit | 2a0d872c48cb7735194d66f23e71daa1d55713b4 (patch) | |
tree | e44049bc686efe8e2820aa0c54fe3bc958a11ed2 | |
parent | 35b679f1b69b4e29a9c37f258fdefc712e032fcb (diff) | |
download | chromium_src-2a0d872c48cb7735194d66f23e71daa1d55713b4.zip chromium_src-2a0d872c48cb7735194d66f23e71daa1d55713b4.tar.gz chromium_src-2a0d872c48cb7735194d66f23e71daa1d55713b4.tar.bz2 |
Clear the refferer registry entry upon succesful ping
- Is not needed after that point
BUG = 1517308
Review URL: http://codereview.chromium.org/16552
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7689 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/rlz/rlz.cc | 4 | ||||
-rw-r--r-- | chrome/installer/util/google_update_settings.cc | 23 | ||||
-rw-r--r-- | chrome/installer/util/google_update_settings.h | 4 |
3 files changed, 25 insertions, 6 deletions
diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc index bdd8abb..d65f180 100644 --- a/chrome/browser/rlz/rlz.cc +++ b/chrome/browser/rlz/rlz.cc @@ -183,8 +183,10 @@ class DailyPingTask : public Task { std::wstring referral; GoogleUpdateSettings::GetReferral(&referral); if (SendFinancialPing(brand.c_str(), lang.c_str(), referral.c_str(), - is_organic(brand))) + is_organic(brand))) { access_values_state = ACCESS_VALUES_STALE; + GoogleUpdateSettings::ClearReferral(); + } } // Organic brands all start with GG, such as GGCM. diff --git a/chrome/installer/util/google_update_settings.cc b/chrome/installer/util/google_update_settings.cc index 8168be2..cb122f8 100644 --- a/chrome/installer/util/google_update_settings.cc +++ b/chrome/installer/util/google_update_settings.cc @@ -16,18 +16,27 @@ std::wstring GetClientStateKeyPath() { return reg_path; } -bool ReadGoogleUpdateStrKey(const wchar_t* const key_name, - std::wstring* value) { +bool ReadGoogleUpdateStrKey(const wchar_t* const name, std::wstring* value) { std::wstring reg_path = GetClientStateKeyPath(); RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ); - if (!key.ReadValue(key_name, value)) { + if (!key.ReadValue(name, value)) { RegKey hklm_key(HKEY_LOCAL_MACHINE, reg_path.c_str(), KEY_READ); - return hklm_key.ReadValue(key_name, value); + return hklm_key.ReadValue(name, value); } return true; } + +bool ClearGoogleUpdateStrKey(const wchar_t* const name) { + std::wstring reg_path = GetClientStateKeyPath(); + RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ | KEY_WRITE); + std::wstring value; + if (!key.ReadValue(name, &value)) + return false; + return key.WriteValue(name, L""); } +} // namespace. + bool GoogleUpdateSettings::GetCollectStatsConsent() { std::wstring reg_path = GetClientStateKeyPath(); RegKey key(HKEY_CURRENT_USER, reg_path.c_str(), KEY_READ); @@ -60,5 +69,9 @@ bool GoogleUpdateSettings::GetBrand(std::wstring* brand) { } bool GoogleUpdateSettings::GetReferral(std::wstring* referral) { - return ReadGoogleUpdateStrKey(google_update::kRegReferralField, referral); + return ReadGoogleUpdateStrKey(google_update::kRegReferralField, referral); +} + +bool GoogleUpdateSettings::ClearReferral() { + return ClearGoogleUpdateStrKey(google_update::kRegReferralField); } diff --git a/chrome/installer/util/google_update_settings.h b/chrome/installer/util/google_update_settings.h index d5c6876..f45d1fc 100644 --- a/chrome/installer/util/google_update_settings.h +++ b/chrome/installer/util/google_update_settings.h @@ -40,6 +40,10 @@ class GoogleUpdateSettings { // partners. This value does not exist for most chrome or chromium installs. static bool GetReferral(std::wstring* referral); + // Overwrites the current value of the referral with an empty string. Returns + // true if this operation succeeded. + static bool ClearReferral(); + private: DISALLOW_IMPLICIT_CONSTRUCTORS(GoogleUpdateSettings); }; |