#include "chrome/browser/browser_process.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/google/google_util.h"
+#include "chrome/browser/omnibox/omnibox_log.h"
#include "chrome/browser/prefs/session_startup_pref.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_service.h"
bool is_google_in_startpages,
bool already_ran,
bool omnibox_used,
- bool homepage_used) {
+ bool homepage_used,
+ bool app_list_used) {
TRACE_EVENT0("RLZ", "RecordProductEvents");
// Record the installation of chrome. We call this all the time but the rlz
// lib should ignore all but the first one.
rlz_lib::RecordProductEvent(rlz_lib::CHROME,
RLZTracker::CHROME_HOME_PAGE,
rlz_lib::INSTALL);
+ rlz_lib::RecordProductEvent(rlz_lib::CHROME,
+ RLZTracker::CHROME_APP_LIST,
+ rlz_lib::INSTALL);
#endif // !defined(OS_IOS)
if (!already_ran) {
RLZTracker::CHROME_HOME_PAGE,
rlz_lib::SET_TO_GOOGLE);
}
+
+ char app_list_rlz[rlz_lib::kMaxRlzLength + 1];
+ if (!rlz_lib::GetAccessPointRlz(RLZTracker::CHROME_APP_LIST, app_list_rlz,
+ rlz_lib::kMaxRlzLength)) {
+ app_list_rlz[0] = 0;
+ }
+
+ // Record if google is the initial search provider and/or home page.
+ if ((first_run || app_list_rlz[0] == 0) && is_google_default_search) {
+ rlz_lib::RecordProductEvent(rlz_lib::CHROME,
+ RLZTracker::CHROME_APP_LIST,
+ rlz_lib::SET_TO_GOOGLE);
+ }
#endif // !defined(OS_IOS)
}
RLZTracker::CHROME_HOME_PAGE,
rlz_lib::FIRST_SEARCH);
}
+
+ // Record first user interaction with the app list. We call this all the
+ // time but the rlz lib should ingore all but the first one.
+ if (app_list_used) {
+ rlz_lib::RecordProductEvent(rlz_lib::CHROME,
+ RLZTracker::CHROME_APP_LIST,
+ rlz_lib::FIRST_SEARCH);
+ }
#endif // !defined(OS_IOS)
}
rlz_lib::AccessPoint points[] = {RLZTracker::CHROME_OMNIBOX,
#if !defined(OS_IOS)
RLZTracker::CHROME_HOME_PAGE,
+ RLZTracker::CHROME_APP_LIST,
#endif
rlz_lib::NO_ACCESS_POINT};
std::string lang_ascii(base::UTF16ToASCII(lang));
// static
const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE =
rlz_lib::CHROME_HOME_PAGE;
+// static
+const rlz_lib::AccessPoint RLZTracker::CHROME_APP_LIST =
+ rlz_lib::CHROME_APP_LIST;
#elif defined(OS_IOS)
// static
const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX =
// static
const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE =
rlz_lib::CHROME_MAC_HOME_PAGE;
+// static
+const rlz_lib::AccessPoint RLZTracker::CHROME_APP_LIST =
+ rlz_lib::CHROME_MAC_APP_LIST;
#elif defined(OS_CHROMEOS)
// static
const rlz_lib::AccessPoint RLZTracker::CHROME_OMNIBOX =
// static
const rlz_lib::AccessPoint RLZTracker::CHROME_HOME_PAGE =
rlz_lib::CHROMEOS_HOME_PAGE;
+// static
+const rlz_lib::AccessPoint RLZTracker::CHROME_APP_LIST =
+ rlz_lib::CHROMEOS_APP_LIST;
#endif
RLZTracker* RLZTracker::tracker_ = NULL;
already_ran_(false),
omnibox_used_(false),
homepage_used_(false),
+ app_list_used_(false),
min_init_delay_(kMinInitDelay) {
}
if (!IsBrandOrganic(brand_)) {
RecordProductEvents(first_run_, is_google_default_search_,
is_google_homepage_, is_google_in_startpages_,
- already_ran_, omnibox_used_, homepage_used_);
+ already_ran_, omnibox_used_, homepage_used_,
+ app_list_used_);
schedule_ping = true;
}
rlz_lib::SupplementaryBranding branding(reactivation_brand_.c_str());
RecordProductEvents(first_run_, is_google_default_search_,
is_google_homepage_, is_google_in_startpages_,
- already_ran_, omnibox_used_, homepage_used_);
+ already_ran_, omnibox_used_, homepage_used_,
+ app_list_used_);
schedule_ping = true;
}
GetAccessPointRlz(RLZTracker::CHROME_OMNIBOX, NULL);
#if !defined(OS_IOS)
GetAccessPointRlz(RLZTracker::CHROME_HOME_PAGE, NULL);
+ GetAccessPointRlz(RLZTracker::CHROME_APP_LIST, NULL);
#endif // !defined(OS_IOS)
}
const content::NotificationDetails& details) {
switch (type) {
case chrome::NOTIFICATION_OMNIBOX_OPENED_URL:
+ // In M-36, we made NOTIFICATION_OMNIBOX_OPENED_URL fire more often than
+ // it did previously. The RLZ folks want RLZ's "first search" detection
+ // to remain as unaffected as possible by this change. This test is
+ // there to keep the old behavior.
+ if (!content::Details<OmniboxLog>(details).ptr()->is_popup_open)
+ break;
RecordFirstSearch(CHROME_OMNIBOX);
registrar_.Remove(this, chrome::NOTIFICATION_OMNIBOX_OPENED_URL,
content::NotificationService::AllSources());
if (ScheduleRecordFirstSearch(point))
return;
-#if !defined(OS_IOS)
- bool* record_used = point == CHROME_OMNIBOX ?
- &omnibox_used_ : &homepage_used_;
-#else
- DCHECK_EQ(CHROME_OMNIBOX, point);
- bool* record_used = &omnibox_used_;
-#endif
+ bool* record_used = GetAccessPointRecord(point);
// Try to record event now, else set the flag to try later when we
// attempt the ping.
return true;
}
+bool* RLZTracker::GetAccessPointRecord(rlz_lib::AccessPoint point) {
+ if (point == CHROME_OMNIBOX)
+ return &omnibox_used_;
+#if !defined(OS_IOS)
+ if (point == CHROME_HOME_PAGE)
+ return &homepage_used_;
+ if (point == CHROME_APP_LIST)
+ return &app_list_used_;
+#endif // !defined(OS_IOS)
+ NOTREACHED();
+ return NULL;
+}
+
// static
std::string RLZTracker::GetAccessPointHttpHeader(rlz_lib::AccessPoint point) {
TRACE_EVENT0("RLZ", "RLZTracker::GetAccessPointHttpHeader");
void RLZTracker::EnableZeroDelayForTesting() {
GetInstance()->min_init_delay_ = base::TimeDelta();
}
+
+#if !defined(OS_IOS)
+// static
+void RLZTracker::RecordAppListSearch() {
+ GetInstance()->RecordFirstSearch(RLZTracker::CHROME_APP_LIST);
+}
+#endif