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 [Native] |
| 15 enum DataLoss; |
| 16 |
| 17 [Native] |
| 18 struct KeyPath; |
| 19 |
| 20 struct IndexMetadata { |
| 21 int64 id; |
| 22 mojo.common.mojom.String16 name; |
| 23 KeyPath key_path; |
| 24 bool unique; |
| 25 bool multi_entry; |
| 26 }; |
| 27 |
| 28 struct ObjectStoreMetadata { |
| 29 int64 id; |
| 30 mojo.common.mojom.String16 name; |
| 31 KeyPath key_path; |
| 32 bool auto_increment; |
| 33 int64 max_index_id; |
| 34 array<IndexMetadata> indexes; |
| 35 }; |
| 36 |
| 37 struct DatabaseMetadata { |
| 38 int64 id; |
| 39 mojo.common.mojom.String16 name; |
| 40 int64 version; |
| 41 int64 max_object_store_id; |
| 42 array<ObjectStoreMetadata> object_stores; |
| 43 }; |
| 44 |
| 45 // The Callbacks interface is used to return results for individual requests. |
| 46 // Some requests may return multiple results before completion, such as |
| 47 // UpgradeNeeded before SuccessDatabase. |
| 48 // |
| 49 // TODO(https://crbug.com/627484): Many of these could be replaced with |
| 50 // replies associated with particular messages. |
| 51 interface Callbacks { |
| 52 Error(int32 code, mojo.common.mojom.String16 message); |
| 53 |
| 54 // Factory::GetDatabaseNames |
| 55 SuccessStringList(array<mojo.common.mojom.String16> value); |
| 56 |
| 57 // Factory::Open / DeleteDatabase |
| 58 Blocked(int64 existing_version); |
| 59 |
| 60 // Factory::Open |
| 61 UpgradeNeeded(int32 database_id, int64 old_version, DataLoss data_loss, |
| 62 string data_loss_message, DatabaseMetadata db_metadata); |
| 63 SuccessDatabase(int32 database_id, DatabaseMetadata metadata); |
| 64 |
| 65 // Factory::DeleteDatabase |
| 66 SuccessInteger(int64 value); |
| 67 }; |
| 68 |
| 69 // The DatabaseCallbacks interface is used to notification of events out of |
| 70 // band to individual requests. A single instance is used for the lifetime of |
| 71 // a database connection. |
| 72 interface DatabaseCallbacks { |
| 73 ForcedClose(); |
| 74 VersionChange(int64 old_version, int64 new_version); |
| 75 Abort(int64 transaction_id, int32 code, |
| 76 mojo.common.mojom.String16 message); |
| 77 Complete(int64 transaction_id); |
| 78 }; |
| 79 |
| 80 interface Factory { |
| 81 GetDatabaseNames(associated Callbacks callbacks, url.mojom.Origin origin); |
| 82 Open(int32 worker_thread, associated Callbacks callbacks, |
| 83 associated DatabaseCallbacks database_callbacks, url.mojom.Origin origin, |
| 84 mojo.common.mojom.String16 name, int64 version, int64 transaction_id); |
| 85 DeleteDatabase(associated Callbacks callbacks, url.mojom.Origin origin, |
| 86 mojo.common.mojom.String16 name); |
| 87 }; |
OLD | NEW |