Skip to content

Commit

Permalink
rlz: Change omnibox / homepage access points from C1/C2 to C5/C6 on mac
Browse files Browse the repository at this point in the history
BUG=134939
TEST=none

Review URL: https://chromiumcodereview.appspot.com/10698024

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145337 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
thakis@chromium.org committed Jul 3, 2012
1 parent 60263c7 commit b935e7a
Show file tree
Hide file tree
Showing 5 changed files with 157 additions and 112 deletions.
46 changes: 31 additions & 15 deletions chrome/browser/rlz/rlz.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,37 +61,37 @@ void RecordProductEvents(bool first_run, bool google_default_search,
// Record the installation of chrome. We call this all the time but the rlz
// lib should ingore all but the first one.
rlz_lib::RecordProductEvent(rlz_lib::CHROME,
rlz_lib::CHROME_OMNIBOX,
RLZTracker::CHROME_OMNIBOX,
rlz_lib::INSTALL);
rlz_lib::RecordProductEvent(rlz_lib::CHROME,
rlz_lib::CHROME_HOME_PAGE,
RLZTracker::CHROME_HOME_PAGE,
rlz_lib::INSTALL);

if (!already_ran) {
// Do the initial event recording if is the first run or if we have an
// empty rlz which means we haven't got a chance to do it.
char omnibox_rlz[rlz_lib::kMaxRlzLength + 1];
if (!rlz_lib::GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, omnibox_rlz,
if (!rlz_lib::GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, omnibox_rlz,
rlz_lib::kMaxRlzLength)) {
omnibox_rlz[0] = 0;
}

// Record if google is the initial search provider and/or home page.
if ((first_run || omnibox_rlz[0] == 0) && google_default_search) {
rlz_lib::RecordProductEvent(rlz_lib::CHROME,
rlz_lib::CHROME_OMNIBOX,
RLZTracker::CHROME_OMNIBOX,
rlz_lib::SET_TO_GOOGLE);
}

char homepage_rlz[rlz_lib::kMaxRlzLength + 1];
if (!rlz_lib::GetAccessPointRlz(rlz_lib::CHROME_HOME_PAGE, homepage_rlz,
if (!rlz_lib::GetAccessPointRlz(RLZTracker::CHROME_HOME_PAGE, homepage_rlz,
rlz_lib::kMaxRlzLength)) {
homepage_rlz[0] = 0;
}

if ((first_run || homepage_rlz[0] == 0) && google_default_homepage) {
rlz_lib::RecordProductEvent(rlz_lib::CHROME,
rlz_lib::CHROME_HOME_PAGE,
RLZTracker::CHROME_HOME_PAGE,
rlz_lib::SET_TO_GOOGLE);
}
}
Expand All @@ -100,24 +100,24 @@ void RecordProductEvents(bool first_run, bool google_default_search,
// time but the rlz lib should ingore all but the first one.
if (omnibox_used) {
rlz_lib::RecordProductEvent(rlz_lib::CHROME,
rlz_lib::CHROME_OMNIBOX,
RLZTracker::CHROME_OMNIBOX,
rlz_lib::FIRST_SEARCH);
}

// Record first user interaction with the home page. We call this all the
// time but the rlz lib should ingore all but the first one.
if (homepage_used) {
rlz_lib::RecordProductEvent(rlz_lib::CHROME,
rlz_lib::CHROME_HOME_PAGE,
RLZTracker::CHROME_HOME_PAGE,
rlz_lib::FIRST_SEARCH);
}
}

bool SendFinancialPing(const std::string& brand,
const string16& lang,
const string16& referral) {
rlz_lib::AccessPoint points[] = {rlz_lib::CHROME_OMNIBOX,
rlz_lib::CHROME_HOME_PAGE,
rlz_lib::AccessPoint points[] = {RLZTracker::CHROME_OMNIBOX,
RLZTracker::CHROME_HOME_PAGE,
rlz_lib::NO_ACCESS_POINT};
std::string lang_ascii(UTF16ToASCII(lang));
std::string referral_ascii(UTF16ToASCII(referral));
Expand All @@ -128,6 +128,22 @@ bool SendFinancialPing(const std::string& brand,

} // namespace

#if !defined(OS_MACOSX)
// static
const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX =
rlz_lib::CHROME_OMNIBOX;
// static
const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE =
rlz_lib::CHROME_HOME_PAGE;
#else
// static
const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX =
rlz_lib::CHROME_MAC_OMNIBOX;
// static
const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE =
rlz_lib::CHROME_MAC_HOME_PAGE;
#endif

RLZTracker* RLZTracker::tracker_ = NULL;

// static
Expand Down Expand Up @@ -269,8 +285,8 @@ void RLZTracker::PingNowImpl() {
}

// Prime the RLZ cache for the access points we are interested in.
GetAccessPointRlz(rlz_lib::CHROME_OMNIBOX, NULL);
GetAccessPointRlz(rlz_lib::CHROME_HOME_PAGE, NULL);
GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, NULL);
GetAccessPointRlz(RLZTracker::CHROME_HOME_PAGE, NULL);
}

std::string reactivation_brand;
Expand Down Expand Up @@ -300,7 +316,7 @@ void RLZTracker::Observe(int type,
switch (type) {
case chrome::NOTIFICATION_OMNIBOX_OPENED_URL:
case chrome::NOTIFICATION_INSTANT_CONTROLLER_UPDATED:
point = rlz_lib::CHROME_OMNIBOX;
point = RLZTracker::CHROME_OMNIBOX;
record_used = &omnibox_used_;
call_record = true;

Expand All @@ -315,7 +331,7 @@ void RLZTracker::Observe(int type,
if (entry != NULL &&
((entry->GetTransitionType() &
content::PAGE_TRANSITION_HOME_PAGE) != 0)) {
point = rlz_lib::CHROME_HOME_PAGE;
point = RLZTracker::CHROME_HOME_PAGE;
record_used = &homepage_used_;
call_record = true;

Expand All @@ -334,7 +350,7 @@ void RLZTracker::Observe(int type,
// attempt the ping.
if (!RecordProductEvent(rlz_lib::CHROME, point, rlz_lib::FIRST_SEARCH))
*record_used = true;
else if (send_ping_immediately_ && point == rlz_lib::CHROME_OMNIBOX) {
else if (send_ping_immediately_ && point == RLZTracker::CHROME_OMNIBOX) {
ScheduleDelayedInit(0);
}
}
Expand Down
4 changes: 4 additions & 0 deletions chrome/browser/rlz/rlz.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ class RLZTracker : public content::NotificationObserver {
rlz_lib::AccessPoint point,
rlz_lib::Event event_id);

// For the point parameter of RecordProductEvent.
static const rlz_lib::AccessPoint CHROME_OMNIBOX;
static const rlz_lib::AccessPoint CHROME_HOME_PAGE;

// Get the RLZ value of the access point.
// Returns false if the rlz string could not be obtained. In some cases
// an empty string can be returned which is not an error.
Expand Down
Loading

0 comments on commit b935e7a

Please sign in to comment.