chromium/components/policy/core/common/cloud/external_policy_data_updater.cc

// Copyright 2013 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/policy/core/common/cloud/external_policy_data_updater.h"

#include <utility>

#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/task/sequenced_task_runner.h"
#include "components/policy/core/common/cloud/external_policy_data_fetcher.h"
#include "components/policy/core/common/policy_logger.h"
#include "crypto/sha2.h"
#include "net/base/backoff_entry.h"
#include "url/gurl.h"

namespace policy {

namespace {

// Policies for exponential backoff of failed requests. There are 3 policies for
// different classes of errors.

// For temporary errors (HTTP 500, RST, etc).
const net::BackoffEntry::Policy kRetrySoonPolicy =;

// For other errors (request failed, server errors).
const net::BackoffEntry::Policy kRetryLaterPolicy =;

// When the data fails validation (maybe because the policy URL and the data
// served at that URL are out of sync). This essentially retries every 12 hours,
// with some random jitter.
const net::BackoffEntry::Policy kRetryMuchLaterPolicy =;

// Maximum number of retries for requests that aren't likely to get a
// different response (e.g. HTTP 4xx replies).
const int kMaxLimitedRetries =;

}  // namespace

class ExternalPolicyDataUpdater::FetchJob final {};

ExternalPolicyDataUpdater::Request::Request() = default;

ExternalPolicyDataUpdater::Request::Request(const std::string& url,
                                            const std::string& hash,
                                            int64_t max_size)
    :{}

bool ExternalPolicyDataUpdater::Request::operator==(
    const Request& other) const {}

ExternalPolicyDataUpdater::FetchJob::FetchJob(
    ExternalPolicyDataUpdater* updater,
    const std::string& key,
    const ExternalPolicyDataUpdater::Request& request,
    const ExternalPolicyDataUpdater::FetchSuccessCallback& callback)
    :{}

ExternalPolicyDataUpdater::FetchJob::~FetchJob() {}

const std::string& ExternalPolicyDataUpdater::FetchJob::key() const {}

const ExternalPolicyDataUpdater::Request&
ExternalPolicyDataUpdater::FetchJob::request() const {}

void ExternalPolicyDataUpdater::FetchJob::Start() {}

void ExternalPolicyDataUpdater::FetchJob::OnFetchFinished(
    ExternalPolicyDataFetcher::Result result,
    std::unique_ptr<std::string> data) {}

void ExternalPolicyDataUpdater::FetchJob::OnFailed(net::BackoffEntry* entry) {}

void ExternalPolicyDataUpdater::FetchJob::Reschedule() {}

ExternalPolicyDataUpdater::ExternalPolicyDataUpdater(
    scoped_refptr<base::SequencedTaskRunner> task_runner,
    std::unique_ptr<ExternalPolicyDataFetcher> external_policy_data_fetcher,
    size_t max_parallel_fetches)
    :{}

ExternalPolicyDataUpdater::~ExternalPolicyDataUpdater() {}

void ExternalPolicyDataUpdater::FetchExternalData(
    const std::string& key,
    const Request& request,
    const FetchSuccessCallback& callback) {}

void ExternalPolicyDataUpdater::CancelExternalDataFetch(
    const std::string& key) {}

void ExternalPolicyDataUpdater::StartNextJobs() {}

void ExternalPolicyDataUpdater::ScheduleJob(FetchJob* job) {}

void ExternalPolicyDataUpdater::OnJobSucceeded(FetchJob* job) {}

void ExternalPolicyDataUpdater::OnJobFailed(FetchJob* job) {}

}  // namespace policy