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

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

Issue 2707773003: Improve the resolution of the menu item homescreen launch source metric. (Closed)
Patch Set: 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 a29a5c4b5f6fe48f4d13d7d630cc552d8893bb9c..adad42e8e356f8ea3f60489ecb9c4e3dc88a5fe1 100644
--- a/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
+++ b/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
@@ -113,6 +113,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.
@@ -192,10 +194,10 @@ 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);
// WebAPKs are wholly defined by the Web Manifest. Ignore the <meta> tag
@@ -209,6 +211,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