Don't offer desktop PWA installation if the site is in-scope of an existing app.
Prior to this CL, desktop PWA installation only checked for the presence
of an existing app with the exact same start URL as the current site.
This means that once a site is installed, if it changes its start URL,
desktop Chrome will think the site is not installed, and allow it to be
installed again.
This CL makes the desktop behaviour match Android: check if there is an
existing app whose scope encloses the start URL of the current site, and
disallow installation if that is the case.
This means that "nested" PWAs can no longer be installed on desktop, but
we need a more robust solution involving more stable PWA ids to make
that work well. It is better to have consistent behaviour between
mobile and desktop for now.
BUG=1015317
Change-Id: I031e58dedbf4326aa9260cdb11ce1845e63b1ea9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2172188
Reviewed-by: Alan Cutter <[email protected]>
Reviewed-by: Daniel Murphy <[email protected]>
Commit-Queue: Dominick Ng <[email protected]>
Cr-Commit-Position: refs/heads/master@{#764971}
diff --git a/chrome/browser/android/shortcut_helper.cc b/chrome/browser/android/shortcut_helper.cc
index a20cc07..cd45a0a 100644
--- a/chrome/browser/android/shortcut_helper.cc
+++ b/chrome/browser/android/shortcut_helper.cc
@@ -330,11 +330,8 @@
// static
bool ShortcutHelper::IsWebApkInstalled(content::BrowserContext* browser_context,
- const GURL& start_url,
- const GURL& manifest_url) {
- return !QueryFirstWebApkPackage(start_url).empty() ||
- (!manifest_url.is_empty() && WebApkInstallService::Get(browser_context)
- ->IsInstallInProgress(manifest_url));
+ const GURL& url) {
+ return !QueryFirstWebApkPackage(url).empty();
}
// static