chromium/chrome/common/offline_page_auto_fetcher.mojom

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

module chrome.mojom;

enum OfflinePageAutoFetcherScheduleResult {
  // There are too many in flight requests, so the new request was not
  // scheduled.
  kNotEnoughQuota,
  // An error prevented the request from being scheduled.
  kOtherError,
  // There already exists a request for the URL, so the request was not
  // scheduled.
  kAlreadyScheduled,
  // The request was scheduled.
  kScheduled
};

// Provides controls for fetching offline pages automatically and quietly in
// the background.
interface OfflinePageAutoFetcher {
  // Attempts to schedule an auto fetch for the URL on the current page.
  // If user_requested is false, only schedules the fetch if there is remaining
  // quota.
  TrySchedule(bool user_requested) =>
    (OfflinePageAutoFetcherScheduleResult out);

  // Cancels a previously scheduled auto fetch for the URL of the current page.
  CancelSchedule();
};