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

Unified Diff: chrome/browser/banners/app_banner_data_fetcher.cc

Issue 2122783002: Add metrics for app banner preventDefault() and prompt(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Splitting out into a new metric Created 4 years, 5 months 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/banners/app_banner_metrics.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/banners/app_banner_data_fetcher.cc
diff --git a/chrome/browser/banners/app_banner_data_fetcher.cc b/chrome/browser/banners/app_banner_data_fetcher.cc
index 2b647326e23d618c591d55348a9d47c8026b3cd5..736a9a1b56112fa1c445fb6c4efd01a69f1787e9 100644
--- a/chrome/browser/banners/app_banner_data_fetcher.cc
+++ b/chrome/browser/banners/app_banner_data_fetcher.cc
@@ -115,6 +115,9 @@ void AppBannerDataFetcher::Cancel() {
if (is_active_) {
FOR_EACH_OBSERVER(Observer, observer_list_,
OnDecidedWhetherToShow(this, false));
+ if (was_canceled_by_page_ && !page_requested_prompt_)
+ TrackBeforeInstallEvent(BEFORE_INSTALL_EVENT_PROMPT_NOT_CALLED);
benwells 2016/07/05 05:34:49 Nit: This name is a bit misleading, I think it mea
dominickn 2016/07/05 06:00:09 Done.
+
is_active_ = false;
was_canceled_by_page_ = false;
page_requested_prompt_ = false;
@@ -188,6 +191,7 @@ void AppBannerDataFetcher::OnBannerPromptReply(
// Stash the referrer for the case where the banner is redisplayed.
if (reply == blink::WebAppBannerPromptReply::Cancel &&
!page_requested_prompt_) {
+ TrackBeforeInstallEvent(BEFORE_INSTALL_EVENT_PREVENT_DEFAULT);
was_canceled_by_page_ = true;
referrer_ = referrer;
OutputDeveloperNotShownMessage(web_contents, kRendererRequestCancel,
@@ -202,6 +206,7 @@ void AppBannerDataFetcher::OnBannerPromptReply(
FOR_EACH_OBSERVER(Observer, observer_list_,
OnDecidedWhetherToShow(this, true));
+ TrackBeforeInstallEvent(BEFORE_INSTALL_EVENT_COMPLETE);
ShowBanner(app_icon_url_, app_icon_.get(), app_title_, referrer);
is_active_ = false;
}
@@ -209,6 +214,8 @@ void AppBannerDataFetcher::OnBannerPromptReply(
void AppBannerDataFetcher::OnRequestShowAppBanner(
content::RenderFrameHost* render_frame_host,
int request_id) {
+ TrackBeforeInstallEvent(BEFORE_INSTALL_EVENT_PROMPT_CALLED);
+
if (was_canceled_by_page_) {
// Simulate an "OK" from the website to restart the banner display pipeline.
was_canceled_by_page_ = false;
@@ -401,6 +408,8 @@ void AppBannerDataFetcher::OnAppIconFetched(const SkBitmap& bitmap) {
app_icon_.reset(new SkBitmap(bitmap));
event_request_id_ = ++gCurrentRequestID;
+
+ TrackBeforeInstallEvent(BEFORE_INSTALL_EVENT_CREATED);
web_contents->GetMainFrame()->Send(
new ChromeViewMsg_AppBannerPromptRequest(
web_contents->GetMainFrame()->GetRoutingID(),
« no previous file with comments | « no previous file | chrome/browser/banners/app_banner_metrics.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698