OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // TODO: This will move to //third_party/WebKit when //content/child/indexed_db |
| 6 // is deleted but for now this will depend on //content/common types and so |
| 7 // so belongs here. |
| 8 |
| 9 module indexed_db.mojom; |
| 10 |
| 11 import "mojo/common/common_custom_types.mojom"; |
| 12 import "url/mojo/origin.mojom"; |
| 13 |
| 14 enum DataLoss { |
| 15 None = 0, |
| 16 Total, |
| 17 }; |
| 18 |
| 19 [Native] |
| 20 struct KeyPath; |
| 21 |
| 22 struct IndexMetadata { |
| 23 int64 id; |
| 24 mojo.common.mojom.String16 name; |
| 25 KeyPath key_path; |
| 26 bool unique; |
| 27 bool multi_entry; |
| 28 }; |
| 29 |
| 30 struct ObjectStoreMetadata { |
| 31 int64 id; |
| 32 mojo.common.mojom.String16 name; |
| 33 KeyPath key_path; |
| 34 bool auto_increment; |
| 35 int64 max_index_id; |
| 36 array<IndexMetadata> indexes; |
| 37 }; |
| 38 |
| 39 struct DatabaseMetadata { |
| 40 int64 id; |
| 41 mojo.common.mojom.String16 name; |
| 42 int64 version; |
| 43 int64 max_object_store_id; |
| 44 array<ObjectStoreMetadata> object_stores; |
| 45 }; |
| 46 |
| 47 interface Callbacks { |
| 48 Blocked(int64 existing_version); |
| 49 Error(int32 code, mojo.common.mojom.String16 message); |
| 50 SuccessDatabase(int32 database_id, DatabaseMetadata metadata); |
| 51 SuccessInteger(int64 value); |
| 52 SuccessStringList(array<mojo.common.mojom.String16> value); |
| 53 UpgradeNeeded(int32 database_id, int64 old_version, DataLoss data_loss, |
| 54 string data_loss_message, DatabaseMetadata db_metadata); |
| 55 }; |
| 56 |
| 57 interface DatabaseCallbacks { |
| 58 ForcedClose(); |
| 59 VersionChange(int64 old_version, int64 new_version); |
| 60 Abort(int64 transaction_id, int32 code, |
| 61 mojo.common.mojom.String16 message); |
| 62 Complete(int64 transaction_id); |
| 63 }; |
| 64 |
| 65 interface Factory { |
| 66 GetDatabaseNames(associated Callbacks callbacks, url.mojom.Origin origin); |
| 67 Open(int32 worker_thread, associated Callbacks callbacks, |
| 68 associated DatabaseCallbacks database_callbacks, url.mojom.Origin origin, |
| 69 mojo.common.mojom.String16 name, int64 version, int64 transaction_id); |
| 70 DeleteDatabase(associated Callbacks callbacks, url.mojom.Origin origin, |
| 71 mojo.common.mojom.String16 name); |
| 72 }; |
OLD | NEW |