| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2012 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 [ |
| 6 { |
| 7 "namespace": "storage", |
| 8 "unprivileged": true, |
| 9 "compiler_options": { |
| 10 "generate_type_functions": true |
| 11 }, |
| 12 "types": [ |
| 13 { |
| 14 "id": "StorageChange", |
| 15 "type": "object", |
| 16 "properties": { |
| 17 "oldValue": { |
| 18 "type": "any", |
| 19 "description": "The old value of the item, if there was an old value
.", |
| 20 "optional": true |
| 21 }, |
| 22 "newValue": { |
| 23 "type": "any", |
| 24 "description": "The new value of the item, if there is a new value."
, |
| 25 "optional": true |
| 26 } |
| 27 } |
| 28 }, |
| 29 { |
| 30 "id": "StorageArea", |
| 31 "type": "object", |
| 32 "functions": [ |
| 33 { |
| 34 "name": "get", |
| 35 "type": "function", |
| 36 "description": "Gets one or more items from storage.", |
| 37 "parameters": [ |
| 38 { |
| 39 "name": "keys", |
| 40 "choices": [ |
| 41 { "type": "string" }, |
| 42 { "type": "array", "items": { "type": "string" } }, |
| 43 { |
| 44 "type": "object", |
| 45 "description": "Storage items to return in the callback, whe
re the values are replaced with those from storage if they exist.", |
| 46 "additionalProperties": { "type": "any" } |
| 47 } |
| 48 ], |
| 49 "description": "A single key to get, list of keys to get, or a d
ictionary specifying default values (see description of the object). An empty l
ist or object will return an empty result object. Pass in <code>null</code> to
get the entire contents of storage.", |
| 50 "optional": true |
| 51 }, |
| 52 { |
| 53 "name": "callback", |
| 54 "type": "function", |
| 55 "description": "Callback with storage items, or on failure (in w
hich case $ref:runtime.lastError will be set).", |
| 56 "parameters": [ |
| 57 { |
| 58 "name": "items", |
| 59 "type": "object", |
| 60 "additionalProperties": { "type": "any" }, |
| 61 "description": "Object with items in their key-value mapping
s." |
| 62 } |
| 63 ] |
| 64 } |
| 65 ] |
| 66 }, |
| 67 { |
| 68 "name": "getBytesInUse", |
| 69 "type": "function", |
| 70 "description": "Gets the amount of space (in bytes) being used by on
e or more items.", |
| 71 "parameters": [ |
| 72 { |
| 73 "name": "keys", |
| 74 "choices": [ |
| 75 { "type": "string" }, |
| 76 { "type": "array", "items": { "type": "string" } } |
| 77 ], |
| 78 "description": "A single key or list of keys to get the total us
age for. An empty list will return 0. Pass in <code>null</code> to get the total
usage of all of storage.", |
| 79 "optional": true |
| 80 }, |
| 81 { |
| 82 "name": "callback", |
| 83 "type": "function", |
| 84 "description": "Callback with the amount of space being used by
storage, or on failure (in which case $ref:runtime.lastError will be set).", |
| 85 "parameters": [ |
| 86 { |
| 87 "name": "bytesInUse", |
| 88 "type": "integer", |
| 89 "description": "Amount of space being used in storage, in by
tes." |
| 90 } |
| 91 ] |
| 92 } |
| 93 ] |
| 94 }, |
| 95 { |
| 96 "name": "set", |
| 97 "type": "function", |
| 98 "description": "Sets multiple items.", |
| 99 "parameters": [ |
| 100 { |
| 101 "name": "items", |
| 102 "type": "object", |
| 103 "additionalProperties": { "type": "any" }, |
| 104 "description": "Object specifying items to augment storage with.
Values that cannot be serialized (functions, etc) will be ignored." |
| 105 }, |
| 106 { |
| 107 "name": "callback", |
| 108 "type": "function", |
| 109 "description": "Callback on success, or on failure (in which cas
e $ref:runtime.lastError will be set).", |
| 110 "parameters": [], |
| 111 "optional": true |
| 112 } |
| 113 ] |
| 114 }, |
| 115 { |
| 116 "name": "remove", |
| 117 "type": "function", |
| 118 "description": "Removes one or more items from storage.", |
| 119 "parameters": [ |
| 120 { |
| 121 "name": "keys", |
| 122 "choices": [ |
| 123 {"type": "string"}, |
| 124 {"type": "array", "items": {"type": "string"}} |
| 125 ], |
| 126 "description": "A single key or a list of keys for items to remo
ve." |
| 127 }, |
| 128 { |
| 129 "name": "callback", |
| 130 "type": "function", |
| 131 "description": "Callback on success, or on failure (in which cas
e $ref:runtime.lastError will be set).", |
| 132 "parameters": [], |
| 133 "optional": true |
| 134 } |
| 135 ] |
| 136 }, |
| 137 { |
| 138 "name": "clear", |
| 139 "type": "function", |
| 140 "description": "Removes all items from storage.", |
| 141 "parameters": [ |
| 142 { |
| 143 "name": "callback", |
| 144 "type": "function", |
| 145 "description": "Callback on success, or on failure (in which cas
e $ref:runtime.lastError will be set).", |
| 146 "parameters": [], |
| 147 "optional": true |
| 148 } |
| 149 ] |
| 150 } |
| 151 ] |
| 152 } |
| 153 ], |
| 154 "events": [ |
| 155 { |
| 156 "name": "onChanged", |
| 157 "type": "function", |
| 158 "description": "Fired when one or more items change.", |
| 159 "parameters": [ |
| 160 { |
| 161 "name": "changes", |
| 162 "type": "object", |
| 163 "additionalProperties": { "$ref": "StorageChange" }, |
| 164 "description": "Object mapping each key that changed to its correspo
nding $ref:StorageChange for that item." |
| 165 }, |
| 166 { |
| 167 "name": "areaName", |
| 168 "type": "string", |
| 169 "description": "The name of the storage area (<code>sync</code> or <
code>local</code>) the changes are for." |
| 170 } |
| 171 ] |
| 172 } |
| 173 ], |
| 174 "properties": { |
| 175 "sync": { |
| 176 "$ref": "StorageArea", |
| 177 "description": "Items in the <code>sync</code> storage area are synced u
sing Chrome Sync.", |
| 178 "value": [ "sync" ], |
| 179 "properties": { |
| 180 "QUOTA_BYTES": { |
| 181 "value": 102400, |
| 182 "description": "The maximum total amount (in bytes) of data that can
be stored in sync storage, as measured by the JSON stringification of every val
ue plus every key's length. Updates that would cause this limit to be exceeded f
ail immediately and set $ref:runtime.lastError." |
| 183 }, |
| 184 "QUOTA_BYTES_PER_ITEM": { |
| 185 "value": 4096, |
| 186 "description": "The maximum size (in bytes) of each individual item
in sync storage, as measured by the JSON stringification of its value plus its k
ey length. Updates containing items larger than this limit will fail immediately
and set $ref:runtime.lastError." |
| 187 }, |
| 188 "MAX_ITEMS": { |
| 189 "value": 512, |
| 190 "description": "The maximum number of items that can be stored in sy
nc storage. Updates that would cause this limit to be exceeded will fail immedia
tely and set $ref:runtime.lastError." |
| 191 }, |
| 192 "MAX_WRITE_OPERATIONS_PER_HOUR": { |
| 193 "value": 1000, |
| 194 "description": "The maximum number of <code>set</code>, <code>remove
</code>, or <code>clear</code> operations that can be performed each hour. Updat
es that would cause this limit to be exceeded fail immediately and set $ref:runt
ime.lastError." |
| 195 }, |
| 196 "MAX_SUSTAINED_WRITE_OPERATIONS_PER_MINUTE": { |
| 197 "value": 10, |
| 198 "description": "The maximum number of <code>set</code>, <code>remove
</code>, or <code>clear</code> operations that can be performed each minute, sus
tained over 10 minutes. Updates that would cause this limit to be exceeded fail
immediately and set $ref:runtime.lastError." |
| 199 } |
| 200 } |
| 201 }, |
| 202 "local": { |
| 203 "$ref": "StorageArea", |
| 204 "description": "Items in the <code>local</code> storage area are local t
o each machine.", |
| 205 "value": [ "local" ], |
| 206 "properties": { |
| 207 "QUOTA_BYTES": { |
| 208 "value": 5242880, |
| 209 "description": "The maximum amount (in bytes) of data that can be st
ored in local storage, as measured by the JSON stringification of every value pl
us every key's length. This value will be ignored if the extension has the <code
>unlimitedStorage</code> permission. Updates that would cause this limit to be e
xceeded fail immediately and set $ref:runtime.lastError." |
| 210 } |
| 211 } |
| 212 }, |
| 213 "managed": { |
| 214 "$ref": "StorageArea", |
| 215 "description": "Items in the <code>managed</code> storage area are set b
y the domain administrator, and are read-only by the extension; trying to modify
this namespace results in an error.", |
| 216 "value": [ "managed" ], |
| 217 "nodoc": true |
| 218 } |
| 219 } |
| 220 } |
| 221 ] |
| OLD | NEW |