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

Unified Diff: chrome/browser/rlz/rlz.cc

Issue 8726041: Add support for reactivating a chrome install that originally used an (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 1 month 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
« no previous file with comments | « no previous file | chrome/browser/rlz/rlz_unittest.cc » ('j') | chrome/browser/rlz/rlz_unittest.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/rlz/rlz.cc
===================================================================
--- chrome/browser/rlz/rlz.cc (revision 111916)
+++ chrome/browser/rlz/rlz.cc (working copy)
@@ -40,6 +40,10 @@
namespace {
+bool IsBrandOrganic(const std::string& brand) {
+ return brand.empty() || google_util::IsOrganic(brand);
+}
+
void RecordProductEvents(bool first_run, bool google_default_search,
bool google_default_homepage, bool already_ran,
bool omnibox_used, bool homepage_used) {
@@ -106,21 +110,6 @@
rlz_lib::NO_ACCESS_POINT};
std::string lang_ascii(WideToASCII(lang));
std::string referral_ascii(WideToASCII(referral));
-
- // If chrome has been reactivated, send a ping for this brand as well.
- // We ignore the return value of SendFinancialPing() since we'll try again
- // later anyway. Callers of this function are only interested in whether
- // the ping for the main brand succeeded or not.
- std::string reactivation_brand;
- if (google_util::GetReactivationBrand(&reactivation_brand)) {
- string16 reactivation_brand16 = UTF8ToUTF16(reactivation_brand);
- rlz_lib::SupplementaryBranding branding(reactivation_brand16.c_str());
- rlz_lib::SendFinancialPing(rlz_lib::CHROME, points, "chrome",
- reactivation_brand.c_str(),
- referral_ascii.c_str(), lang_ascii.c_str(),
- false, NULL, true);
- }
-
return rlz_lib::SendFinancialPing(rlz_lib::CHROME, points, "chrome",
brand.c_str(), referral_ascii.c_str(),
lang_ascii.c_str(), false, NULL, true);
@@ -209,31 +198,35 @@
}
void RLZTracker::DelayedInit() {
+ bool schedule_ping = false;
+
// For organic brandcodes do not use rlz at all. Empty brandcode usually
// means a chromium install. This is ok.
std::string brand;
- if (!google_util::GetBrand(&brand) || brand.empty() ||
- google_util::IsOrganic(brand))
- return;
+ if (google_util::GetBrand(&brand) && !IsBrandOrganic(brand)) {
+ RecordProductEvents(first_run_, google_default_search_,
+ google_default_homepage_, already_ran_,
+ omnibox_used_, homepage_used_);
+ schedule_ping = true;
+ }
- RecordProductEvents(first_run_, google_default_search_,
- google_default_homepage_, already_ran_,
- omnibox_used_, homepage_used_);
-
// If chrome has been reactivated, record the events for this brand
// as well.
std::string reactivation_brand;
- if (google_util::GetReactivationBrand(&reactivation_brand)) {
+ if (google_util::GetReactivationBrand(&reactivation_brand) &&
+ !IsBrandOrganic(reactivation_brand)) {
string16 reactivation_brand16 = UTF8ToUTF16(reactivation_brand);
rlz_lib::SupplementaryBranding branding(reactivation_brand16.c_str());
RecordProductEvents(first_run_, google_default_search_,
google_default_homepage_, already_ran_,
omnibox_used_, homepage_used_);
+ schedule_ping = true;
}
already_ran_ = true;
- ScheduleFinancialPing();
+ if (schedule_ping)
+ ScheduleFinancialPing();
}
void RLZTracker::ScheduleFinancialPing() {
@@ -254,11 +247,12 @@
GoogleUpdateSettings::GetLanguage(&lang);
if (lang.empty())
lang = L"en";
- std::string brand;
- google_util::GetBrand(&brand);
string16 referral;
GoogleUpdateSettings::GetReferral(&referral);
- if (SendFinancialPing(brand, lang, referral)) {
+
+ std::string brand;
+ if (google_util::GetBrand(&brand) && !IsBrandOrganic(brand) &&
+ SendFinancialPing(brand, lang, referral)) {
GoogleUpdateSettings::ClearReferral();
{
@@ -270,6 +264,14 @@
GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, NULL);
GetAccessPointRlz(rlz_lib::CHROME_HOME_PAGE, NULL);
}
+
+ std::string reactivation_brand;
+ if (google_util::GetReactivationBrand(&reactivation_brand) &&
+ !IsBrandOrganic(reactivation_brand)) {
+ string16 reactivation_brand16 = UTF8ToUTF16(reactivation_brand);
+ rlz_lib::SupplementaryBranding branding(reactivation_brand16.c_str());
+ SendFinancialPing(reactivation_brand, lang, referral);
+ }
}
bool RLZTracker::SendFinancialPing(const std::string& brand,
« no previous file with comments | « no previous file | chrome/browser/rlz/rlz_unittest.cc » ('j') | chrome/browser/rlz/rlz_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698