chromium/third_party/blink/public/mojom/webdatabase/web_database.mojom

// Copyright 2017 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 "mojo/public/mojom/base/file.mojom";
import "mojo/public/mojom/base/string16.mojom";
import "url/mojom/origin.mojom";

// WebDatabase messages sent from the browser to the renderer.
interface WebDatabase {
  // Notifies the renderer process of the new database size.
  UpdateSize(url.mojom.Origin origin,
             mojo_base.mojom.String16 name,
             int64 size);

  // Asks the renderer process to close a database immediately.
  CloseImmediately(url.mojom.Origin origin, mojo_base.mojom.String16 name);
};

interface WebDatabaseHost {
  // Asks the browser process to open a DB file with the given name.
  [Sync]
  OpenFile(mojo_base.mojom.String16 vfs_file_name,
           int32 desired_flags) => (mojo_base.mojom.File? file);

  // Asks the browser process to delete a DB file.
  [Sync]
  DeleteFile(mojo_base.mojom.String16 vfs_file_name,
             bool sync_dir) => (int32 sqlite_error_code);

  // Asks the browser process to return the attributes of a DB file.
  [Sync]
  GetFileAttributes(mojo_base.mojom.String16 vfs_file_name) => (
      int32 attributes);

  // Asks the browser process for the amount of space available to an origin.
  [Sync]
  GetSpaceAvailable(url.mojom.Origin origin) => (int64 space_available);

  // Notifies the browser process that a new database has been opened
  Opened(url.mojom.Origin origin, mojo_base.mojom.String16 database_name,
         mojo_base.mojom.String16 database_description);

  // Notifies the browser process that a database might have been modified
  Modified(url.mojom.Origin origin, mojo_base.mojom.String16 database_name);

  // Notifies the browser process that a database is about to close
  Closed(url.mojom.Origin origin, mojo_base.mojom.String16 database_name);

  // Sent when a sqlite error indicates the database is corrupt.
  HandleSqliteError(url.mojom.Origin origin,
                    mojo_base.mojom.String16 database_name,
                    int32 error);

};