#include "content/browser/service_worker/service_worker_client.h"
#include <set>
#include "base/containers/adapters.h"
#include "base/containers/contains.h"
#include "base/debug/crash_logging.h"
#include "base/functional/overloaded.h"
#include "base/task/single_thread_task_runner.h"
#include "base/uuid.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/browser/service_worker/service_worker_container_host.h"
#include "content/browser/service_worker/service_worker_context_core.h"
#include "content/browser/service_worker/service_worker_security_utils.h"
#include "content/common/content_navigation_policy.h"
#include "content/public/browser/global_routing_id.h"
#include "content/public/common/content_client.h"
#include "content/public/common/origin_util.h"
#include "mojo/public/cpp/bindings/remote_set.h"
#include "third_party/blink/public/common/service_worker/service_worker_scope_match.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_running_status_callback.mojom.h"
namespace content {
namespace {
void RunCallbacks(
std::vector<ServiceWorkerClient::ExecutionReadyCallback> callbacks) { … }
}
class ServiceWorkerClient::PendingUpdateVersion { … };
class ServiceWorkerClient::ServiceWorkerRunningStatusObserver final
: public ServiceWorkerVersion::Observer { … };
ServiceWorkerClient::ServiceWorkerClient(
base::WeakPtr<ServiceWorkerContextCore> context,
bool is_parent_frame_secure,
int frame_tree_node_id)
: … { … }
ServiceWorkerClient::ServiceWorkerClient(
base::WeakPtr<ServiceWorkerContextCore> context,
int process_id,
ServiceWorkerClientInfo client_info)
: … { … }
ServiceWorkerClient::~ServiceWorkerClient() { … }
void ServiceWorkerClient::HintToUpdateServiceWorker() { … }
void ServiceWorkerClient::EnsureFileAccess(
const std::vector<base::FilePath>& file_paths,
blink::mojom::ServiceWorkerContainerHost::EnsureFileAccessCallback
callback) { … }
void ServiceWorkerClient::OnExecutionReady() { … }
void ServiceWorkerClient::OnVersionAttributesChanged(
ServiceWorkerRegistration* registration,
blink::mojom::ChangedServiceWorkerObjectsMaskPtr changed_mask) { … }
void ServiceWorkerClient::OnRegistrationFailed(
ServiceWorkerRegistration* registration) { … }
void ServiceWorkerClient::OnRegistrationFinishedUninstalling(
ServiceWorkerRegistration* registration) { … }
void ServiceWorkerClient::OnSkippedWaiting(
ServiceWorkerRegistration* registration) { … }
void ServiceWorkerClient::AddMatchingRegistration(
ServiceWorkerRegistration* registration) { … }
void ServiceWorkerClient::RemoveMatchingRegistration(
ServiceWorkerRegistration* registration) { … }
ServiceWorkerRegistration* ServiceWorkerClient::MatchRegistration() const { … }
void ServiceWorkerClient::AddServiceWorkerToUpdate(
scoped_refptr<ServiceWorkerVersion> version) { … }
void ServiceWorkerClient::CountFeature(blink::mojom::WebFeature feature) { … }
void ServiceWorkerClient::NotifyControllerLost() { … }
void ServiceWorkerClient::ClaimedByRegistration(
scoped_refptr<ServiceWorkerRegistration> registration) { … }
blink::mojom::ServiceWorkerClientType ServiceWorkerClient::GetClientType()
const { … }
bool ServiceWorkerClient::IsContainerForWindowClient() const { … }
bool ServiceWorkerClient::IsContainerForWorkerClient() const { … }
ServiceWorkerClientInfo ServiceWorkerClient::GetServiceWorkerClientInfo()
const { … }
blink::mojom::ServiceWorkerContainerInfoForClientPtr
ServiceWorkerClient::CommitResponse(
base::PassKey<ScopedServiceWorkerClient>,
std::optional<GlobalRenderFrameHostId> rfh_id,
const PolicyContainerPolicies& policy_container_policies,
mojo::PendingRemote<network::mojom::CrossOriginEmbedderPolicyReporter>
coep_reporter,
ukm::SourceId ukm_source_id) { … }
void ServiceWorkerClient::OnEndNavigationCommit() { … }
void ServiceWorkerClient::UpdateUrlsInternal(
const GURL& url,
const std::optional<url::Origin>& top_frame_origin,
const blink::StorageKey& storage_key) { … }
void ServiceWorkerClient::UpdateUrls(
const GURL& url,
const std::optional<url::Origin>& top_frame_origin,
const blink::StorageKey& storage_key) { … }
void ServiceWorkerClient::UpdateUrlsAfterCommitResponseForTesting(
const GURL& url,
const std::optional<url::Origin>& top_frame_origin,
const blink::StorageKey& storage_key) { … }
void ServiceWorkerClient::SetControllerRegistration(
scoped_refptr<ServiceWorkerRegistration> controller_registration,
bool notify_controllerchange) { … }
bool ServiceWorkerClient::IsEligibleForServiceWorkerController() const { … }
bool ServiceWorkerClient::is_response_committed() const { … }
bool ServiceWorkerClient::is_container_ready() const { … }
void ServiceWorkerClient::AddExecutionReadyCallback(
ExecutionReadyCallback callback) { … }
bool ServiceWorkerClient::is_execution_ready() const { … }
GlobalRenderFrameHostId ServiceWorkerClient::GetRenderFrameHostId() const { … }
int ServiceWorkerClient::GetProcessId() const { … }
NavigationRequest* ServiceWorkerClient::GetOngoingNavigationRequestBeforeCommit(
base::PassKey<StoragePartitionImpl>) const { … }
const std::string& ServiceWorkerClient::client_uuid() const { … }
ServiceWorkerVersion* ServiceWorkerClient::controller() const { … }
ServiceWorkerRegistration* ServiceWorkerClient::controller_registration()
const { … }
bool ServiceWorkerClient::IsInBackForwardCache() const { … }
void ServiceWorkerClient::EvictFromBackForwardCache(
BackForwardCacheMetrics::NotRestoredReason reason) { … }
void ServiceWorkerClient::OnEnterBackForwardCache() { … }
void ServiceWorkerClient::OnRestoreFromBackForwardCache() { … }
void ServiceWorkerClient::SyncMatchingRegistrations() { … }
#if DCHECK_IS_ON()
bool ServiceWorkerClient::IsMatchingRegistration(
ServiceWorkerRegistration* registration) const { … }
#endif
void ServiceWorkerClient::RemoveAllMatchingRegistrations() { … }
void ServiceWorkerClient::SetExecutionReady() { … }
void ServiceWorkerClient::RunExecutionReadyCallbacks() { … }
void ServiceWorkerClient::TransitionToClientPhase(ClientPhase new_phase) { … }
void ServiceWorkerClient::UpdateController(bool notify_controllerchange) { … }
#if DCHECK_IS_ON()
void ServiceWorkerClient::CheckControllerConsistency(bool should_crash) const { … }
#endif
const GURL& ServiceWorkerClient::GetUrlForScopeMatch() const { … }
void ServiceWorkerClient::InheritControllerFrom(
ServiceWorkerClient& creator_host,
const GURL& blob_url) { … }
mojo::PendingReceiver<blink::mojom::ServiceWorkerRunningStatusCallback>
ServiceWorkerClient::GetRunningStatusCallbackReceiver() { … }
void ServiceWorkerClient::SetContainerReady() { … }
void ServiceWorkerClient::FlushFeatures() { … }
BASE_FEATURE(…);
}