// Copyright 2021 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_NEW_SCRIPT_FETCHER_H_ #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_NEW_SCRIPT_FETCHER_H_ #include "base/functional/callback.h" #include "base/memory/raw_ref.h" #include "base/memory/scoped_refptr.h" #include "base/memory/weak_ptr.h" #include "content/browser/service_worker/service_worker_version.h" #include "content/common/content_export.h" #include "mojo/public/cpp/bindings/receiver.h" #include "services/network/public/mojom/url_loader.mojom.h" #include "third_party/blink/public/mojom/loader/fetch_client_settings_object.mojom.h" #include "third_party/blink/public/mojom/worker/worker_main_script_load_params.mojom.h" namespace content { class ServiceWorkerContextCore; class ServiceWorkerVersion; // PlzServiceWorker: // Fetches the service worker's main script and creates // blink::mojom::WorkerMainScriptLoadParams to start a worker. // // This is used only when the worker is newly installed and the byte-for-byte // update checking is not invoked. The worker script needs to be loaded on the // browser process before selecting a process for the worker thread because we // need to know whether the worker thread needs to be in the COOP-COEP protected // process or not. // // Internally, this class creates ServiceWorkerNewScriptLoader to start loading // the script. After receiving the response header and the Mojo data pipe for // the body, the Mojo endpoints owned by this instance gets unbound and passed // to the struct blink::mojom::WorkerMainScriptLoadParams along with the // response header and the Mojo data pipe so that the renderer takes over // ownership of ServiceWorkerNewScriptLoader. class CONTENT_EXPORT ServiceWorkerNewScriptFetcher : public network::mojom::URLLoaderClient { … }; } // namespace content #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_NEW_SCRIPT_FETCHER_H_