mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-28 16:26:10 +03:00
361 lines
9.8 KiB
Plaintext
361 lines
9.8 KiB
Plaintext
// Copyright 2016 The Chromium Authors. All rights reserved.
|
|
// 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_path.mojom";
|
|
import "mojo/public/mojom/base/string16.mojom";
|
|
import "mojo/public/mojom/base/string16.mojom";
|
|
import "mojo/public/mojom/base/time.mojom";
|
|
import "third_party/blink/public/mojom/blob/blob.mojom";
|
|
import "url/mojom/origin.mojom";
|
|
|
|
// kIDBMaxMessageSize is 128MB, originally based on
|
|
// IPC::Channel::kMaximumMessageSize. The "usable" size is this value less
|
|
// the overhead size.
|
|
const int32 kIDBMaxMessageSize = 134217728;
|
|
|
|
// kIDBMaxMessageOverhead is the size we expect to be used for the rest of
|
|
// the message we will send. The "usable" size is the max size less this value.
|
|
const int32 kIDBMaxMessageOverhead = 1048576; // 1MB; arbitrarily chosen.
|
|
|
|
enum IDBCursorDirection {
|
|
Next,
|
|
NextNoDuplicate,
|
|
Prev,
|
|
PrevNoDuplicate,
|
|
};
|
|
|
|
enum IDBDataLoss {
|
|
None,
|
|
Total,
|
|
};
|
|
|
|
// Represents key types that hold no data and so cannot be options in the
|
|
// IDBKeyData union.
|
|
// TODO(jsbell): These types should be cleaned up end-to-end, leaving only the
|
|
// dataful options.
|
|
enum IDBDatalessKeyType {
|
|
Invalid,
|
|
Null,
|
|
};
|
|
|
|
union IDBKeyData {
|
|
array<IDBKey> key_array;
|
|
array<uint8> binary;
|
|
mojo_base.mojom.String16 string;
|
|
double date;
|
|
double number;
|
|
IDBDatalessKeyType other;
|
|
};
|
|
|
|
// Defined as a structure so that it can by typemapped with StructTraits.
|
|
struct IDBKey {
|
|
IDBKeyData data;
|
|
};
|
|
|
|
// Represents WebIDBKeyPathTypeString and WebIDBKeyPathTypeArray in a key path.
|
|
union IDBKeyPathData {
|
|
mojo_base.mojom.String16 string;
|
|
array<mojo_base.mojom.String16> string_array;
|
|
};
|
|
|
|
struct IDBKeyPath {
|
|
// A null value here corresponds to WebIDBKeyPathTypeNull.
|
|
IDBKeyPathData? data;
|
|
};
|
|
|
|
struct IDBKeyRange {
|
|
IDBKey lower;
|
|
IDBKey upper;
|
|
bool lower_open;
|
|
bool upper_open;
|
|
};
|
|
|
|
enum IDBOperationType {
|
|
Add,
|
|
Put,
|
|
Delete,
|
|
Clear,
|
|
};
|
|
|
|
enum IDBPutMode {
|
|
AddOrUpdate,
|
|
AddOnly,
|
|
CursorUpdate,
|
|
};
|
|
|
|
enum IDBTaskType {
|
|
Normal,
|
|
Preemptive,
|
|
};
|
|
|
|
enum IDBTransactionMode {
|
|
ReadOnly,
|
|
ReadWrite,
|
|
VersionChange,
|
|
};
|
|
|
|
enum IDBStatus {
|
|
OK,
|
|
NotFound,
|
|
Corruption,
|
|
NotSupported,
|
|
InvalidArgument,
|
|
IOError,
|
|
};
|
|
|
|
struct IDBIndexMetadata {
|
|
int64 id;
|
|
mojo_base.mojom.String16 name;
|
|
IDBKeyPath key_path;
|
|
bool unique;
|
|
bool multi_entry;
|
|
};
|
|
|
|
struct IDBObjectStoreMetadata {
|
|
int64 id;
|
|
mojo_base.mojom.String16 name;
|
|
IDBKeyPath key_path;
|
|
bool auto_increment;
|
|
int64 max_index_id;
|
|
array<IDBIndexMetadata> indexes;
|
|
};
|
|
|
|
struct IDBDatabaseMetadata {
|
|
int64 id;
|
|
mojo_base.mojom.String16 name;
|
|
int64 version;
|
|
int64 max_object_store_id;
|
|
array<IDBObjectStoreMetadata> object_stores;
|
|
};
|
|
|
|
struct IDBIndexKeys {
|
|
int64 index_id;
|
|
array<IDBKey> index_keys;
|
|
};
|
|
|
|
struct IDBFileInfo {
|
|
mojo_base.mojom.FilePath path;
|
|
mojo_base.mojom.String16 name;
|
|
mojo_base.mojom.Time last_modified;
|
|
};
|
|
|
|
struct IDBBlobInfo {
|
|
blink.mojom.Blob blob;
|
|
string uuid;
|
|
mojo_base.mojom.String16 mime_type;
|
|
int64 size;
|
|
IDBFileInfo? file;
|
|
};
|
|
|
|
struct IDBValue {
|
|
string bits;
|
|
array<IDBBlobInfo> blob_or_file_info;
|
|
};
|
|
|
|
struct IDBReturnValue {
|
|
IDBValue value;
|
|
IDBKey primary_key;
|
|
IDBKeyPath key_path;
|
|
};
|
|
|
|
struct IDBObservation {
|
|
int64 object_store_id;
|
|
IDBOperationType type;
|
|
IDBKeyRange key_range;
|
|
IDBValue? value;
|
|
};
|
|
|
|
struct IDBObserverTransaction {
|
|
int64 id;
|
|
array<int64> scope;
|
|
};
|
|
|
|
struct IDBObserverChanges {
|
|
map<int32, array<int32>> observation_index_map;
|
|
map<int32, IDBObserverTransaction> transaction_map;
|
|
array<IDBObservation> observations;
|
|
};
|
|
|
|
// The IDBCallbacks interface is used to return results for individual requests.
|
|
// Some requests may return multiple results before completion, such as
|
|
// UpgradeNeeded before SuccessDatabase.
|
|
//
|
|
// TODO(https://crbug.com/627484): Many of these could be replaced with
|
|
// replies associated with particular messages.
|
|
interface IDBCallbacks {
|
|
Error(int32 code, mojo_base.mojom.String16 message);
|
|
|
|
// Factory::GetDatabaseNames
|
|
SuccessStringList(array<mojo_base.mojom.String16> value);
|
|
|
|
// Factory::Open / DeleteDatabase
|
|
Blocked(int64 existing_version);
|
|
|
|
// Factory::Open
|
|
UpgradeNeeded(associated IDBDatabase database, int64 old_version,
|
|
IDBDataLoss data_loss, string data_loss_message,
|
|
IDBDatabaseMetadata db_metadata);
|
|
SuccessDatabase(associated IDBDatabase? database,
|
|
IDBDatabaseMetadata metadata);
|
|
|
|
// Database::OpenCursor
|
|
SuccessCursor(associated IDBCursor cursor,
|
|
IDBKey key,
|
|
IDBKey primary_key,
|
|
IDBValue? value);
|
|
|
|
// Database::Get / Cursor::Advance
|
|
SuccessValue(IDBReturnValue? value);
|
|
|
|
// Cursor::Continue / Advance
|
|
SuccessCursorContinue(IDBKey key, IDBKey primary_key, IDBValue? value);
|
|
|
|
// Cursor::Prefetch
|
|
SuccessCursorPrefetch(array<IDBKey> keys,
|
|
array<IDBKey> primary_keys,
|
|
array<IDBValue> values);
|
|
|
|
// Database::GetAll
|
|
SuccessArray(array<IDBReturnValue> values);
|
|
|
|
// Database::Put / Cursor::Update
|
|
SuccessKey(IDBKey key);
|
|
|
|
// Database::Count / DeleteRange
|
|
// Factory::DeleteDatabase
|
|
SuccessInteger(int64 value);
|
|
|
|
// Cursor::Continue / Advance
|
|
Success();
|
|
};
|
|
|
|
// The IDBDatabaseCallbacks interface is used to notification of events out of
|
|
// band to individual requests. A single instance is used for the lifetime of
|
|
// a database connection.
|
|
interface IDBDatabaseCallbacks {
|
|
ForcedClose();
|
|
VersionChange(int64 old_version, int64 new_version);
|
|
Abort(int64 transaction_id, int32 code,
|
|
mojo_base.mojom.String16 message);
|
|
Complete(int64 transaction_id);
|
|
Changes(IDBObserverChanges changes);
|
|
};
|
|
|
|
interface IDBCursor {
|
|
Advance(uint32 count, associated IDBCallbacks callbacks);
|
|
// Avoid calling the following function "Continue" since the Mojo
|
|
// Java bindings generate incorrect Java as a result. We've named
|
|
// the following funciton "CursorContinue" as a workaround.
|
|
CursorContinue(IDBKey key,
|
|
IDBKey primary_key,
|
|
associated IDBCallbacks callbacks);
|
|
Prefetch(int32 count, associated IDBCallbacks callbacks);
|
|
PrefetchReset(int32 used_prefetches, int32 unused_prefetches);
|
|
};
|
|
|
|
interface IDBDatabase {
|
|
CreateObjectStore(int64 transaction_id,
|
|
int64 object_store_id,
|
|
mojo_base.mojom.String16 name,
|
|
IDBKeyPath key_path,
|
|
bool auto_increment);
|
|
DeleteObjectStore(int64 transaction_id,
|
|
int64 object_store_id);
|
|
RenameObjectStore(int64 transaction_id,
|
|
int64 object_store_id,
|
|
mojo_base.mojom.String16 new_name);
|
|
CreateTransaction(int64 transaction_id,
|
|
array<int64> object_store_ids,
|
|
IDBTransactionMode mode);
|
|
Close();
|
|
VersionChangeIgnored();
|
|
AddObserver(int64 transaction_id,
|
|
int32 observer_id,
|
|
bool include_transaction,
|
|
bool no_records,
|
|
bool values,
|
|
uint16 operation_types);
|
|
RemoveObservers(array<int32> observers);
|
|
Get(int64 transaction_id,
|
|
int64 object_store_id,
|
|
int64 index_id,
|
|
IDBKeyRange key_range,
|
|
bool key_only,
|
|
associated IDBCallbacks callbacks);
|
|
GetAll(int64 transaction_id,
|
|
int64 object_store_id,
|
|
int64 index_id,
|
|
IDBKeyRange key_range,
|
|
bool key_only,
|
|
int64 max_count,
|
|
associated IDBCallbacks callbacks);
|
|
Put(int64 transaction_id,
|
|
int64 object_store_id,
|
|
IDBValue value,
|
|
IDBKey key,
|
|
IDBPutMode mode,
|
|
array<IDBIndexKeys> index_keys,
|
|
associated IDBCallbacks callbacks);
|
|
SetIndexKeys(int64 transaction_id,
|
|
int64 object_store_id,
|
|
IDBKey primary_key,
|
|
array<IDBIndexKeys> index_keys);
|
|
SetIndexesReady(int64 transaction_id,
|
|
int64 object_store_id,
|
|
array<int64> index_ids);
|
|
OpenCursor(int64 transaction_id,
|
|
int64 object_store_id,
|
|
int64 index_id,
|
|
IDBKeyRange key_range,
|
|
IDBCursorDirection direction,
|
|
bool key_only,
|
|
IDBTaskType task_type,
|
|
associated IDBCallbacks callbacks);
|
|
Count(int64 transaction_id,
|
|
int64 object_store_id,
|
|
int64 index_id,
|
|
IDBKeyRange key_range,
|
|
associated IDBCallbacks callbacks);
|
|
DeleteRange(int64 transaction_id,
|
|
int64 object_store_id,
|
|
IDBKeyRange key_range,
|
|
associated IDBCallbacks callbacks);
|
|
Clear(int64 transaction_id,
|
|
int64 object_store_id,
|
|
associated IDBCallbacks callbacks);
|
|
CreateIndex(int64 transaction_id,
|
|
int64 object_store_id,
|
|
int64 index_id,
|
|
mojo_base.mojom.String16 name,
|
|
IDBKeyPath key_path,
|
|
bool unique,
|
|
bool multi_entry);
|
|
DeleteIndex(int64 transaction_id,
|
|
int64 object_store_id,
|
|
int64 index_id);
|
|
RenameIndex(int64 transaction_id,
|
|
int64 object_store_id,
|
|
int64 index_id,
|
|
mojo_base.mojom.String16 new_name);
|
|
Abort(int64 transaction_id);
|
|
Commit(int64 transaction_id);
|
|
};
|
|
|
|
interface IDBFactory {
|
|
GetDatabaseNames(associated IDBCallbacks callbacks, url.mojom.Origin origin);
|
|
Open(associated IDBCallbacks callbacks,
|
|
associated IDBDatabaseCallbacks database_callbacks,
|
|
url.mojom.Origin origin,
|
|
mojo_base.mojom.String16 name,
|
|
int64 version,
|
|
int64 transaction_id);
|
|
DeleteDatabase(associated IDBCallbacks callbacks, url.mojom.Origin origin,
|
|
mojo_base.mojom.String16 name, bool force_close);
|
|
AbortTransactionsAndCompactDatabase(url.mojom.Origin origin) =>
|
|
(IDBStatus status);
|
|
AbortTransactionsForDatabase(url.mojom.Origin origin) => (IDBStatus status);
|
|
};
|