#include "content/browser/background_fetch/background_fetch_context.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/observer_list.h"
#include "content/browser/background_fetch/background_fetch_data_manager.h"
#include "content/browser/background_fetch/background_fetch_job_controller.h"
#include "content/browser/background_fetch/background_fetch_metrics.h"
#include "content/browser/background_fetch/background_fetch_registration_id.h"
#include "content/browser/background_fetch/background_fetch_registration_notifier.h"
#include "content/browser/background_fetch/background_fetch_registration_service_impl.h"
#include "content/browser/background_fetch/background_fetch_request_match_params.h"
#include "content/browser/background_fetch/background_fetch_scheduler.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/browser/storage_partition_impl.h"
#include "content/common/background_fetch/background_fetch_types.h"
#include "content/public/browser/background_fetch_delegate.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/web_contents.h"
#include "storage/browser/blob/blob_data_handle.h"
#include "storage/browser/quota/quota_manager_proxy.h"
#include "third_party/blink/public/common/storage_key/storage_key.h"
namespace content {
FailureReason;
BackgroundFetchContext::BackgroundFetchContext(
base::WeakPtr<StoragePartitionImpl> storage_partition,
const scoped_refptr<ServiceWorkerContextWrapper>& service_worker_context,
scoped_refptr<storage::QuotaManagerProxy> quota_manager_proxy,
DevToolsBackgroundServicesContextImpl& devtools_context)
: … { … }
BackgroundFetchContext::~BackgroundFetchContext() { … }
void BackgroundFetchContext::Initialize() { … }
void BackgroundFetchContext::DidGetInitializationData(
blink::mojom::BackgroundFetchError error,
std::vector<background_fetch::BackgroundFetchInitializationData>
initialization_data) { … }
void BackgroundFetchContext::GetRegistration(
int64_t service_worker_registration_id,
const blink::StorageKey& storage_key,
const std::string& developer_id,
blink::mojom::BackgroundFetchService::GetRegistrationCallback callback) { … }
void BackgroundFetchContext::GetDeveloperIdsForServiceWorker(
int64_t service_worker_registration_id,
const blink::StorageKey& storage_key,
blink::mojom::BackgroundFetchService::GetDeveloperIdsCallback callback) { … }
void BackgroundFetchContext::DidGetRegistration(
blink::mojom::BackgroundFetchService::GetRegistrationCallback callback,
blink::mojom::BackgroundFetchError error,
BackgroundFetchRegistrationId registration_id,
blink::mojom::BackgroundFetchRegistrationDataPtr registration_data) { … }
void BackgroundFetchContext::StartFetch(
const BackgroundFetchRegistrationId& registration_id,
std::vector<blink::mojom::FetchAPIRequestPtr> requests,
blink::mojom::BackgroundFetchOptionsPtr options,
const SkBitmap& icon,
blink::mojom::BackgroundFetchUkmDataPtr ukm_data,
RenderProcessHost* rph,
RenderFrameHostImpl* rfh,
const net::IsolationInfo& isolation_info,
blink::mojom::BackgroundFetchService::FetchCallback callback) { … }
void BackgroundFetchContext::DidGetPermission(
const BackgroundFetchRegistrationId& registration_id,
std::vector<blink::mojom::FetchAPIRequestPtr> requests,
blink::mojom::BackgroundFetchOptionsPtr options,
const SkBitmap& icon,
blink::mojom::BackgroundFetchUkmDataPtr ukm_data,
const GlobalRenderFrameHostId& rfh_id,
const net::IsolationInfo& isolation_info,
BackgroundFetchPermission permission) { … }
void BackgroundFetchContext::GetIconDisplaySize(
blink::mojom::BackgroundFetchService::GetIconDisplaySizeCallback callback) { … }
void BackgroundFetchContext::DidCreateRegistration(
const BackgroundFetchRegistrationId& registration_id,
blink::mojom::BackgroundFetchError error,
blink::mojom::BackgroundFetchRegistrationDataPtr registration_data) { … }
void BackgroundFetchContext::AddRegistrationObserver(
const std::string& unique_id,
mojo::PendingRemote<blink::mojom::BackgroundFetchRegistrationObserver>
observer) { … }
void BackgroundFetchContext::UpdateUI(
const BackgroundFetchRegistrationId& registration_id,
const std::optional<std::string>& title,
const std::optional<SkBitmap>& icon,
blink::mojom::BackgroundFetchRegistrationService::UpdateUICallback
callback) { … }
base::WeakPtr<BackgroundFetchContext> BackgroundFetchContext::GetWeakPtr() { … }
void BackgroundFetchContext::Abort(
const BackgroundFetchRegistrationId& registration_id,
blink::mojom::BackgroundFetchRegistrationService::AbortCallback callback) { … }
void BackgroundFetchContext::MatchRequests(
const BackgroundFetchRegistrationId& registration_id,
std::unique_ptr<BackgroundFetchRequestMatchParams> match_params,
blink::mojom::BackgroundFetchRegistrationService::MatchRequestsCallback
callback) { … }
void BackgroundFetchContext::DidGetMatchingRequests(
const std::string& unique_id,
blink::mojom::BackgroundFetchRegistrationService::MatchRequestsCallback
callback,
blink::mojom::BackgroundFetchError error,
std::vector<blink::mojom::BackgroundFetchSettledFetchPtr> settled_fetches) { … }
void BackgroundFetchContext::Shutdown() { … }
void BackgroundFetchContext::SetDataManagerForTesting(
std::unique_ptr<BackgroundFetchDataManager> data_manager) { … }
}