chromium/third_party/blink/public/mojom/cookie_store/cookie_store.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 blink.mojom;

import "services/network/public/mojom/restricted_cookie_manager.mojom";
import "url/mojom/url.mojom";

struct CookieChangeSubscription {
  url.mojom.Url url;
  network.mojom.CookieMatchType match_type;
  string name;
};

// Tracks ServiceWorker subscriptions to cookie changes.
//
// Most code should access the cookie store via the RestrictedCookieManager
// interface in //services/network. This interface manages service worker
// subscriptions to cookie changes, which currently fall outside the network
// service's scope. The implementation lives in the browser process, because it
// has the ability to wake up service workers in order to dispatch events to
// them.
interface CookieStore {
  // Adds the given subscriptions to the registration's subscription list.
  //
  // This method is idempotent. Subscriptions that are already contained in the
  // registration's subscription list are ignored.
  AddSubscriptions(
      int64 service_worker_registration_id,
      array<CookieChangeSubscription> subscription) => (bool success);

  // Removes the given subscriptions from the registration's subscription list.
  //
  // This method is idempotent. Subscriptions not contained in the
  // registration's subscription list are ignored.
  RemoveSubscriptions(
      int64 service_worker_registration_id,
      array<CookieChangeSubscription> subscription) => (bool success);

  // Returns all cookie change subscriptions for a service worker registration.
  GetSubscriptions(int64 service_worker_registration_id)
      => (array<CookieChangeSubscription> subscriptions, bool success);
};