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

Unified Diff: chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc

Issue 2697473005: Improve the resolution of the menu item homescreen launch source metric. (Closed)
Patch Set: Nits Created 3 years, 10 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 | « chrome/browser/android/shortcut_info.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
diff --git a/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc b/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
index 9f7d15a17e826f26d1652abdf2fe11a084ccc7b7..0731e234ca80a220822189f8558b6dde8b555141 100644
--- a/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
+++ b/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
@@ -122,6 +122,8 @@ void AddToHomescreenDataFetcher::OnDidGetWebApplicationInfo(
if (web_app_info.mobile_capable == WebApplicationInfo::MOBILE_CAPABLE ||
web_app_info.mobile_capable == WebApplicationInfo::MOBILE_CAPABLE_APPLE) {
shortcut_info_.display = blink::WebDisplayModeStandalone;
+ shortcut_info_.UpdateSource(
+ ShortcutInfo::SOURCE_ADD_TO_HOMESCREEN_STANDALONE);
}
// Record what type of shortcut was added by the user.
@@ -206,21 +208,16 @@ void AddToHomescreenDataFetcher::OnDidPerformInstallableCheck(
is_installable_check_complete_ = true;
+ bool webapk_compatible = false;
if (check_webapk_compatibility_) {
- bool webapk_compatible =
- (data.error_code == NO_ERROR_DETECTED &&
- AreWebManifestUrlsWebApkCompatible(data.manifest));
+ webapk_compatible = (data.error_code == NO_ERROR_DETECTED &&
+ AreWebManifestUrlsWebApkCompatible(data.manifest));
weak_observer_->OnDidDetermineWebApkCompatibility(webapk_compatible);
if (webapk_compatible) {
// WebAPKs are wholly defined by the Web Manifest. Ignore the <meta> tag
// data received in OnDidGetWebApplicationInfo().
shortcut_info_ = ShortcutInfo(GURL());
-
- if (data.badge_icon && !data.badge_icon->drawsNothing()) {
- shortcut_info_.best_badge_icon_url = data.badge_icon_url;
- badge_icon_ = *data.badge_icon;
- }
}
}
@@ -229,6 +226,15 @@ void AddToHomescreenDataFetcher::OnDidPerformInstallableCheck(
base::UserMetricsAction("webapps.AddShortcut.Manifest"));
shortcut_info_.UpdateFromManifest(data.manifest);
shortcut_info_.manifest_url = data.manifest_url;
+
+ if (webapk_compatible) {
+ shortcut_info_.UpdateSource(ShortcutInfo::SOURCE_ADD_TO_HOMESCREEN_PWA);
+
+ if (data.badge_icon && !data.badge_icon->drawsNothing()) {
+ shortcut_info_.best_badge_icon_url = data.badge_icon_url;
+ badge_icon_ = *data.badge_icon;
+ }
+ }
}
// Save the splash screen URL for the later download.
« no previous file with comments | « chrome/browser/android/shortcut_info.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698