Add service worker registration options for default web app config
This CL adds two fields to the default web app config JSON:
- load_and_await_service_worker_registration: bool
- service_worker_install_url: URL string
These allow default apps to control their service worker registration
behaviour during the install flow.
Bug: 1123435
Change-Id: Id389c347066a8dbcaa2c2350b884cdb5872e5721
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2409057
Commit-Queue: Alan Cutter <alancutter@chromium.org>
Reviewed-by: Glen Robertson <glenrob@chromium.org>
Cr-Commit-Position: refs/heads/master@{#807358}
diff --git a/chrome/browser/web_applications/components/external_install_options.h b/chrome/browser/web_applications/components/external_install_options.h
index 97172ac..b8ddf2ee 100644
--- a/chrome/browser/web_applications/components/external_install_options.h
+++ b/chrome/browser/web_applications/components/external_install_options.h
@@ -103,6 +103,17 @@
// it.
bool reinstall_placeholder = false;
+ // Whether we should load |service_worker_registration_url| after successful
+ // installation to allow the site to install its service worker and set up
+ // offline caching.
+ bool load_and_await_service_worker_registration = true;
+
+ // The URL to use for service worker registration. This is
+ // configurable by sites that wish to be able to track install metrics of the
+ // install_url separate from the service worker registration step. Defaults to
+ // install_url if unset.
+ base::Optional<GURL> service_worker_registration_url;
+
// A list of app_ids that the Web App System should attempt to uninstall and
// replace with this app (e.g maintain shelf pins, app list positions).
std::vector<AppId> uninstall_and_replace;