chromium/third_party/blink/public/mojom/dom_storage/dom_storage.mojom

// Copyright 2016 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 "third_party/blink/public/mojom/dom_storage/session_storage_namespace.mojom";
import "third_party/blink/public/mojom/dom_storage/storage_area.mojom";
import "third_party/blink/public/mojom/storage_key/storage_key.mojom";
import "third_party/blink/public/mojom/tokens/tokens.mojom";

// This interface is used by renderers to bootstrap their connection to the
// browser's DOM Storage implementation.
interface DomStorageProvider {
  // Binds the renderer's main control interface to the DOM Storage
  // implementation and provides a client interface the browser can use to call
  // back into the renderer.
  BindDomStorage(pending_receiver<DomStorage> receiver,
                 pending_remote<DomStorageClient> client);
};

// The main control interface renderers use to talk to the browser's DOM Storage
// implementation. Each renderer has a single global connection to this
// interface and a corresponding DomStorageClient interface pointing back at the
// renderer.
interface DomStorage {
  // Binds to a StorageArea interface for Local Storage within `storage_key`.
  // `storage_key` must be validated by the browser to ensure the renderer is
  // allowed to access that StorageKey's data. The RenderFrameHost identified
  // by `local_frame_token` must be validated against `storage_key` as well.
  OpenLocalStorage(blink.mojom.StorageKey storage_key,
                   blink.mojom.LocalFrameToken local_frame_token,
                   pending_receiver<StorageArea> area);

  // Binds a control interface for Session Storage within the identified
  // namespace.
  BindSessionStorageNamespace(
      string namespace_id,
      pending_receiver<SessionStorageNamespace> receiver);

  // Binds to a StorageArea interface for Session Storage within `storage_key`
  // and `namespace_id`. `storage_key` must be validated by the browser to
  // ensure the renderer is allowed to access that StorageKey's data. The
  // RenderFrameHost identified by `local_frame_token` must be validated
  // against `storage_key` as well.
  BindSessionStorageArea(
      blink.mojom.StorageKey storage_key,
      blink.mojom.LocalFrameToken local_frame_token,
      string namespace_id,
      pending_receiver<StorageArea> session_namespace);
};

// The main client interface that the browser's DOM Storage implementation can
// use to push notifications to renderers.
interface DomStorageClient {
  // Notifies the client that any of its existing StorageArea and
  // SessionStorageNamespace connections will no longer function properly (e.g.
  // due to a backend crash and recovery) and they should be re-established by
  // the client.
  ResetStorageAreaAndNamespaceConnections();
};