Commit d6b0fe21 authored by Eric Willigers's avatar Eric Willigers Committed by Commit Bot

desktop-pwas: DesktopPWAsCacheDuringDefaultInstall

We add a flag to allow disabling of waiting for Service Worker
to be registered during installation of default installed windows apps.

Bug: 905898
Change-Id: I9649515240ca86023b94b135973a476c046ea38c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1771640
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Commit-Queue: calamity <calamity@chromium.org>
Reviewed-by: default avatarcalamity <calamity@chromium.org>
Auto-Submit: Eric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#691029}
parent 9b1e4e36
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/callback_helpers.h" #include "base/callback_helpers.h"
#include "base/feature_list.h"
#include "base/threading/thread_task_runner_handle.h" #include "base/threading/thread_task_runner_handle.h"
#include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile.h"
#include "chrome/browser/web_applications/components/app_registrar.h" #include "chrome/browser/web_applications/components/app_registrar.h"
...@@ -18,6 +19,7 @@ ...@@ -18,6 +19,7 @@
#include "chrome/browser/web_applications/components/web_app_constants.h" #include "chrome/browser/web_applications/components/web_app_constants.h"
#include "chrome/browser/web_applications/components/web_app_ui_manager.h" #include "chrome/browser/web_applications/components/web_app_ui_manager.h"
#include "chrome/browser/web_applications/pending_app_registration_task.h" #include "chrome/browser/web_applications/pending_app_registration_task.h"
#include "chrome/common/chrome_features.h"
#include "content/public/browser/web_contents.h" #include "content/public/browser/web_contents.h"
namespace web_app { namespace web_app {
...@@ -254,7 +256,9 @@ void PendingAppManagerImpl::OnInstalled(PendingAppInstallTask::Result result) { ...@@ -254,7 +256,9 @@ void PendingAppManagerImpl::OnInstalled(PendingAppInstallTask::Result result) {
void PendingAppManagerImpl::CurrentInstallationFinished( void PendingAppManagerImpl::CurrentInstallationFinished(
const base::Optional<AppId>& app_id, const base::Optional<AppId>& app_id,
InstallResultCode code) { InstallResultCode code) {
if (app_id && code == InstallResultCode::kSuccessNewInstall) { if (app_id && code == InstallResultCode::kSuccessNewInstall &&
base::FeatureList::IsEnabled(
features::kDesktopPWAsCacheDuringDefaultInstall)) {
const GURL& launch_url = registrar()->GetAppLaunchURL(*app_id); const GURL& launch_url = registrar()->GetAppLaunchURL(*app_id);
if (!launch_url.is_empty() && launch_url.scheme() != "chrome") if (!launch_url.is_empty() && launch_url.scheme() != "chrome")
pending_registrations_.push_back(launch_url); pending_registrations_.push_back(launch_url);
......
...@@ -225,6 +225,11 @@ const base::Feature kDesktopCaptureTabSharingInfobar{ ...@@ -225,6 +225,11 @@ const base::Feature kDesktopCaptureTabSharingInfobar{
const base::Feature kDesktopPWAsWithoutExtensions{ const base::Feature kDesktopPWAsWithoutExtensions{
"DesktopPWAsWithoutExtensions", base::FEATURE_DISABLED_BY_DEFAULT}; "DesktopPWAsWithoutExtensions", base::FEATURE_DISABLED_BY_DEFAULT};
// When installing default installed PWAs, we wait for service workers
// to cache resources.
const base::Feature kDesktopPWAsCacheDuringDefaultInstall{
"DesktopPWAsCacheDuringDefaultInstall", base::FEATURE_ENABLED_BY_DEFAULT};
// Enables local PWA installs to update their app manifest data if the site // Enables local PWA installs to update their app manifest data if the site
// changes its manifest. // changes its manifest.
const base::Feature kDesktopPWAsLocalUpdating{"DesktopPWAsLocalUpdating", const base::Feature kDesktopPWAsLocalUpdating{"DesktopPWAsLocalUpdating",
......
...@@ -134,6 +134,9 @@ extern const base::Feature kDesktopCaptureTabSharingInfobar; ...@@ -134,6 +134,9 @@ extern const base::Feature kDesktopCaptureTabSharingInfobar;
COMPONENT_EXPORT(CHROME_FEATURES) COMPONENT_EXPORT(CHROME_FEATURES)
extern const base::Feature kDesktopPWAsWithoutExtensions; extern const base::Feature kDesktopPWAsWithoutExtensions;
COMPONENT_EXPORT(CHROME_FEATURES)
extern const base::Feature kDesktopPWAsCacheDuringDefaultInstall;
COMPONENT_EXPORT(CHROME_FEATURES) COMPONENT_EXPORT(CHROME_FEATURES)
extern const base::Feature kDesktopPWAsLocalUpdating; extern const base::Feature kDesktopPWAsLocalUpdating;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment