// Copyright (c) 2012 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.
[
{
"namespace": "storage",
"unprivileged": true,
"types": [
{
"id": "StorageChange",
"type": "object",
"properties": {
"oldValue": {
"type": "any",
"description": "The old value of the item, if there was an old value.",
"optional": true
},
"newValue": {
"type": "any",
"description": "The new value of the item, if there is a new value.",
"optional": true
}
}
},
{
"id": "StorageArea",
"type": "object",
"functions": [
{
"name": "get",
"type": "function",
"description": "Gets one or more items from storage.",
"parameters": [
{
"name": "keys",
"choices": [
{ "type": "string" },
{ "type": "array", "items": { "type": "string" } },
{
"type": "object",
"description": "Storage items to return in the callback, where the values are replaced with those from storage if they exist.",
"additionalProperties": { "type": "any" }
}
],
"description": "A single key to get, list of keys to get, or a dictionary specifying default values (see description of the object). An empty list or object will return an empty result object. Pass in null
to get the entire contents of storage.",
"optional": true
},
{
"name": "callback",
"type": "function",
"description": "Callback with storage items, or on failure (in which case lastError will be set).",
"parameters": [
{
"name": "items",
"type": "object",
"additionalProperties": { "type": "any" },
"description": "Object with items in their key-value mappings."
}
]
}
]
},
{
"name": "getBytesInUse",
"type": "function",
"description": "Gets the amount of space (in bytes) being used by one or more items.",
"parameters": [
{
"name": "keys",
"choices": [
{ "type": "string" },
{ "type": "array", "items": { "type": "string" } }
],
"description": "A single key or list of keys to get the total usage for. An empty list will return 0. Pass in null
to get the total usage of all of storage.",
"optional": true
},
{
"name": "callback",
"type": "function",
"description": "Callback with the amount of space being used by storage, or on failure (in which case lastError will be set).",
"parameters": [
{
"name": "bytesInUse",
"type": "integer",
"description": "Amount of space being used in storage, in bytes."
}
]
}
]
},
{
"name": "set",
"type": "function",
"description": "Sets multiple items.",
"parameters": [
{
"name": "items",
"type": "object",
"additionalProperties": { "type": "any" },
"description": "Object specifying items to augment storage with. Values that cannot be serialized (functions, etc) will be ignored."
},
{
"name": "callback",
"type": "function",
"description": "Callback on success, or on failure (in which case lastError will be set).",
"parameters": [],
"optional": true
}
]
},
{
"name": "remove",
"type": "function",
"description": "Removes one or more items from storage.",
"parameters": [
{
"name": "keys",
"choices": [
{"type": "string"},
{"type": "array", "items": {"type": "string"}, "minItems": 1}
],
"description": "A single key or a list of keys for items to remove."
},
{
"name": "callback",
"type": "function",
"description": "Callback on success, or on failure (in which case lastError will be set).",
"parameters": [],
"optional": true
}
]
},
{
"name": "clear",
"type": "function",
"description": "Removes all items from storage.",
"parameters": [
{
"name": "callback",
"type": "function",
"description": "Callback on success, or on failure (in which case lastError will be set).",
"parameters": [],
"optional": true
}
]
}
]
}
],
"events": [
{
"name": "onChanged",
"type": "function",
"description": "Fired when one or more items change.",
"parameters": [
{
"name": "changes",
"type": "object",
"additionalProperties": { "$ref": "StorageChange" },
"description": "Object mapping each key that changed to its corresponding StorageChange for that item."
},
{
"name": "namespace",
"type": "string",
"description": "The namespace (\"sync\" or \"local\") of the storage area the changes are for."
}
]
}
],
"properties": {
"sync": {
"$ref": "StorageArea",
"description": "Items under the \"sync\" namespace are synced using Chrome Sync.",
"value": [ "sync" ],
"properties": {
"QUOTA_BYTES": {
"type": "integer",
"value": "102400",
"description": "The maximum total amount (in bytes) of data that can be stored in sync storage."
},
"QUOTA_BYTES_PER_ITEM": {
"type": "integer",
"value": "2048",
"description": "The maximum size (in bytes) of each individual item in sync storage."
},
"MAX_ITEMS": {
"type": "integer",
"value": "512",
"description": "The maximum number of items that can be stored in sync storage."
}
}
},
"local": {
"$ref": "StorageArea",
"description": "Items under the \"local\" namespace are local to each machine.",
"value": [ "local" ],
"properties": {
"QUOTA_BYTES": {
"type": "integer",
"value": "5120000",
"description": "The maximum amount (in bytes) of data that can be stored in local storage. This value may be ignored if the extension has the unlimitedStorage
permission."
}
}
}
}
}
]