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

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

Issue 2937823002: [Android] Make WebApplicationInfo and Web Manifest mutually exclusive (Closed)
Patch Set: Merge branch 'master' into reenable_tests000 Created 3 years, 6 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/android/webapps/add_to_homescreen_data_fetcher_unittest.cc » ('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 e5f3bc8762e6a643138a6cdda0056b39e99880f3..6e00f6997944293de55458adea77c5c5d8854b5d 100644
--- a/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
+++ b/chrome/browser/android/webapps/add_to_homescreen_data_fetcher.cc
@@ -207,46 +207,45 @@ void AddToHomescreenDataFetcher::OnDidPerformInstallableCheck(
is_installable_check_complete_ = true;
+ bool use_manifest = false;
bool webapk_compatible = false;
- if (check_webapk_compatibility_) {
- 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.manifest.IsEmpty()) {
+ if (!data.manifest.name.string().empty() ||
+ !data.manifest.short_name.string().empty()) {
+ use_manifest = true;
base::RecordAction(base::UserMetricsAction("webapps.AddShortcut.Manifest"));
+
+ shortcut_info_ = ShortcutInfo(GURL());
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;
- }
+ if (data.badge_icon && !data.badge_icon->drawsNothing()) {
dominickn 2017/06/15 05:16:23 We only want to grab the badge icon in the case of
+ shortcut_info_.best_badge_icon_url = data.badge_icon_url;
+ badge_icon_ = *data.badge_icon;
}
- }
- // Save the splash screen URL for the later download.
- shortcut_info_.splash_image_url = ManifestIconSelector::FindBestMatchingIcon(
- data.manifest.icons, ideal_splash_image_size_in_px_,
- minimum_splash_image_size_in_px_,
- content::Manifest::Icon::IconPurpose::ANY);
- shortcut_info_.ideal_splash_image_size_in_px = ideal_splash_image_size_in_px_;
- shortcut_info_.minimum_splash_image_size_in_px =
- minimum_splash_image_size_in_px_;
+ // Save the splash screen URL for the later download.
+ shortcut_info_.splash_image_url =
+ ManifestIconSelector::FindBestMatchingIcon(
+ data.manifest.icons, ideal_splash_image_size_in_px_,
+ minimum_splash_image_size_in_px_,
+ content::Manifest::Icon::IconPurpose::ANY);
+ shortcut_info_.ideal_splash_image_size_in_px =
+ ideal_splash_image_size_in_px_;
+ shortcut_info_.minimum_splash_image_size_in_px =
+ minimum_splash_image_size_in_px_;
+
+ webapk_compatible = check_webapk_compatibility_ &&
+ data.error_code == NO_ERROR_DETECTED &&
+ AreWebManifestUrlsWebApkCompatible(data.manifest);
+ if (webapk_compatible)
+ shortcut_info_.UpdateSource(ShortcutInfo::SOURCE_ADD_TO_HOMESCREEN_PWA);
+ }
+ if (check_webapk_compatibility_)
+ weak_observer_->OnDidDetermineWebApkCompatibility(webapk_compatible);
weak_observer_->OnUserTitleAvailable(shortcut_info_.user_title);
- if (data.primary_icon) {
+ if (use_manifest && data.primary_icon) {
dominickn 2017/06/15 05:16:23 I don't think we want to guard this behind use_man
shortcut_info_.best_primary_icon_url = data.primary_icon_url;
CreateLauncherIcon(*(data.primary_icon));
« no previous file with comments | « no previous file | chrome/browser/android/webapps/add_to_homescreen_data_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698