summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/api/storage.json
blob: 63309bb13d5e9bc202cd71c0e20b4753a8629b43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
[
  {
    "namespace": "storage",
    "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",
            "unprivileged": true,
            "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.",
                    "properties": {},
                    "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 <code>null</code> 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",
                    "properties": {},
                    "additionalProperties": { "type": "any" },
                    "description": "Object with items in their key-value mappings."
                  }
                ]
              }
            ]
          },
          {
            "name": "getBytesInUse",
            "unprivileged": true,
            "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 <code>null</code> 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",
            "unprivileged": true,
            "type": "function",
            "description": "Sets multiple items.",
            "parameters": [
              {
                "name": "items",
                "type": "object",
                "properties": {},
                "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",
            "unprivileged": true,
            "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",
            "unprivileged": true,
            "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",
        "unprivileged": true,
        "type": "function",
        "description": "Fired when one or more items change.",
        "parameters": [
          {
            "name": "changes",
            "type": "object",
            "properties": {},
            "additionalProperties": { "$ref": "StorageChange" },
            "description": "Object mapping each key that changed to its corresponding <a href='#type-StorageChange'>StorageChange</a> 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.",
        "unprivileged": true,
        "value": [ "sync" ],
        "properties": {
          "QUOTA_BYTES": {
            "type": "integer",
            "value": "102400",
            "unprivileged": true,
            "description": "The maximum total amount (in bytes) of data that can be stored in sync storage."
          },
          "QUOTA_BYTES_PER_ITEM": {
            "type": "integer",
            "value": "2048",
            "unprivileged": true,
            "description": "The maximum size (in bytes) of each individual item in sync storage."
          },
          "MAX_ITEMS": {
            "type": "integer",
            "value": "512",
            "unprivileged": true,
            "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.",
        "unprivileged": true,
        "value": [ "local" ],
        "properties": {
          "QUOTA_BYTES": {
            "type": "integer",
            "value": "5120000",
            "unprivileged": true,
            "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 <code>unlimitedStorage</code> permission."
          }
        }
      }
    }
  }
]