| Index: content/browser/service_worker/service_worker_version.cc
|
| diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc
|
| index 49294d9b6618cafe268a300463f6464d617057ed..d935a9a0230e5a3dca55caefed24827911c759b0 100644
|
| --- a/content/browser/service_worker/service_worker_version.cc
|
| +++ b/content/browser/service_worker/service_worker_version.cc
|
| @@ -12,6 +12,7 @@
|
|
|
| #include "base/command_line.h"
|
| #include "base/debug/alias.h"
|
| +#include "base/feature_list.h"
|
| #include "base/guid.h"
|
| #include "base/location.h"
|
| #include "base/macros.h"
|
| @@ -46,6 +47,7 @@
|
| #include "content/public/browser/content_browser_client.h"
|
| #include "content/public/browser/render_process_host.h"
|
| #include "content/public/common/content_client.h"
|
| +#include "content/public/common/content_features.h"
|
| #include "content/public/common/content_switches.h"
|
| #include "content/public/common/result_codes.h"
|
| #include "net/http/http_response_headers.h"
|
| @@ -1131,6 +1133,23 @@ void ServiceWorkerVersion::NotifyMainScriptJobCreated(
|
| main_script_job_created_ = status;
|
| }
|
|
|
| +bool ServiceWorkerVersion::IsNavigationPreloadSupported() const {
|
| + if (base::FeatureList::GetInstance()->IsFeatureOverriddenFromCommandLine(
|
| + features::kServiceWorkerNavigationPreload.name,
|
| + base::FeatureList::OVERRIDE_ENABLE_FEATURE)) {
|
| + return true;
|
| + }
|
| + if (!base::FeatureList::IsEnabled(features::kServiceWorkerNavigationPreload))
|
| + return false;
|
| + // The origin trial of Navigation Preload started from M57. And the worker
|
| + // entry in the database written by Chrome (>= M56) must have the
|
| + // origin_trial_tokens field.
|
| + if (!origin_trial_tokens_)
|
| + return false;
|
| + return base::ContainsKey(*origin_trial_tokens_,
|
| + "ServiceWorkerNavigationPreload");
|
| +}
|
| +
|
| void ServiceWorkerVersion::OnSimpleEventResponse(
|
| int request_id,
|
| blink::WebServiceWorkerEventResult result,
|
|
|