#include "content/browser/background_fetch/background_fetch_job_controller.h"
#include <utility>
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/not_fatal_until.h"
#include "content/browser/background_fetch/background_fetch_cross_origin_filter.h"
#include "content/browser/background_fetch/background_fetch_data_manager.h"
#include "content/browser/background_fetch/background_fetch_request_match_params.h"
#include "content/public/browser/browser_thread.h"
#include "services/network/public/cpp/cors/cors.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
#include "third_party/blink/public/mojom/background_fetch/background_fetch.mojom.h"
namespace content {
namespace {
bool IsMixedContent(const BackgroundFetchRequestInfo& request) { … }
bool RequiresCorsPreflight(const BackgroundFetchRequestInfo& request,
const url::Origin& origin) { … }
}
BackgroundFetchError;
BackgroundFetchFailureReason;
BackgroundFetchJobController::BackgroundFetchJobController(
BackgroundFetchDataManager* data_manager,
BackgroundFetchDelegateProxy* delegate_proxy,
const BackgroundFetchRegistrationId& registration_id,
blink::mojom::BackgroundFetchOptionsPtr options,
const SkBitmap& icon,
uint64_t bytes_downloaded,
uint64_t bytes_uploaded,
uint64_t upload_total,
ProgressCallback progress_callback,
FinishedCallback finished_callback)
: … { … }
void BackgroundFetchJobController::InitializeRequestStatus(
int completed_downloads,
int total_downloads,
std::vector<scoped_refptr<BackgroundFetchRequestInfo>>
active_fetch_requests,
bool start_paused,
std::optional<net::IsolationInfo> isolation_info) { … }
BackgroundFetchJobController::~BackgroundFetchJobController() { … }
bool BackgroundFetchJobController::HasMoreRequests() { … }
void BackgroundFetchJobController::StartRequest(
scoped_refptr<BackgroundFetchRequestInfo> request,
RequestFinishedCallback request_finished_callback) { … }
void BackgroundFetchJobController::DidStartRequest(
const std::string& guid,
std::unique_ptr<BackgroundFetchResponse> response) { … }
void BackgroundFetchJobController::DidUpdateRequest(const std::string& guid,
uint64_t bytes_uploaded,
uint64_t bytes_downloaded) { … }
void BackgroundFetchJobController::DidCompleteRequest(
const std::string& guid,
std::unique_ptr<BackgroundFetchResult> result) { … }
blink::mojom::BackgroundFetchRegistrationDataPtr
BackgroundFetchJobController::NewRegistrationData() const { … }
uint64_t BackgroundFetchJobController::GetInProgressDownloadedBytes() { … }
uint64_t BackgroundFetchJobController::GetInProgressUploadedBytes() { … }
void BackgroundFetchJobController::AbortFromDelegate(
BackgroundFetchFailureReason failure_reason) { … }
void BackgroundFetchJobController::Abort(
BackgroundFetchFailureReason failure_reason,
ErrorCallback callback) { … }
void BackgroundFetchJobController::Finish(
BackgroundFetchFailureReason reason_to_abort,
ErrorCallback callback) { … }
void BackgroundFetchJobController::PopNextRequest(
RequestStartedCallback request_started_callback,
RequestFinishedCallback request_finished_callback) { … }
void BackgroundFetchJobController::DidPopNextRequest(
RequestStartedCallback request_started_callback,
RequestFinishedCallback request_finished_callback,
BackgroundFetchError error,
scoped_refptr<BackgroundFetchRequestInfo> request_info) { … }
void BackgroundFetchJobController::MarkRequestAsComplete(
scoped_refptr<BackgroundFetchRequestInfo> request_info) { … }
void BackgroundFetchJobController::DidMarkRequestAsComplete(
BackgroundFetchError error) { … }
void BackgroundFetchJobController::NotifyDownloadComplete(
scoped_refptr<BackgroundFetchRequestInfo> request) { … }
void BackgroundFetchJobController::GetUploadData(
const std::string& guid,
BackgroundFetchDelegate::GetUploadDataCallback callback) { … }
void BackgroundFetchJobController::DidGetUploadData(
BackgroundFetchDelegate::GetUploadDataCallback callback,
BackgroundFetchError error,
blink::mojom::SerializedBlobPtr blob) { … }
}