| OLD | NEW |
| 1 <!-- BEGIN AUTHORED CONTENT --> | |
| 2 <p id="classSummary"> | 1 <p id="classSummary"> |
| 3 Use the <code>chrome.storage</code> module | 2 Use the <code>chrome.storage</code> module |
| 4 to store, retrieve, and track changes to user data. | 3 to store, retrieve, and track changes to user data. |
| 5 This API has been optimized | 4 This API has been optimized |
| 6 to meet the specific storage needs of extensions. | 5 to meet the specific storage needs of extensions. |
| 7 It provides the same storage capabilities as the | 6 It provides the same storage capabilities as the |
| 8 <a href="https://developer.mozilla.org/en/DOM/Storage#localStorage">localStorage
API</a> | 7 <a href="https://developer.mozilla.org/en/DOM/Storage#localStorage">localStorage
API</a> |
| 9 with the following key differences: | 8 with the following key differences: |
| 10 </p> | 9 </p> |
| 11 <ul> | 10 <ul> |
| 12 <li>User data can be automatically synced with Chrome sync | 11 <li>User data can be automatically synced with Chrome sync |
| 13 (using <code>storage.sync</code>).</li> | 12 (using <code>storage.sync</code>).</li> |
| 14 <li>Your extension's content scripts can directly access user data | 13 <li>Your extension's content scripts can directly access user data |
| 15 without the need for a background page.</li> | 14 without the need for a background page.</li> |
| 16 <li>A user's extension settings can be persisted | 15 <li>A user's extension settings can be persisted |
| 17 even when using | 16 even when using |
| 18 <a href="manifest.html#incognito">split incognito behavior</a>.</li> | 17 <a href="manifest.html#incognito">split incognito behavior</a>.</li> |
| 19 <li>User data can be stored as objects | 18 <li>User data can be stored as objects |
| 20 (the <code>localStorage API</code> stores data in strings).</li> | 19 (the <code>localStorage API</code> stores data in strings).</li> |
| 20 <li>Domain policies configured by the administrator for the extension |
| 21 can be read (using <code>storage.managed</code>).</li> |
| 21 </ul> | 22 </ul> |
| 22 <h2 id="manifest">Manifest</h2> | 23 <h2 id="manifest">Manifest</h2> |
| 23 <p>You must declare the "storage" permission in the <a | 24 <p>You must declare the "storage" permission in the <a |
| 24 href="manifest.html">extension manifest</a> | 25 href="manifest.html">extension manifest</a> |
| 25 to use the storage API. | 26 to use the storage API. |
| 26 For example:</p> | 27 For example:</p> |
| 27 <pre>{ | 28 <pre>{ |
| 28 "name": "My extension", | 29 "name": "My extension", |
| 29 ... | 30 ... |
| 30 <b>"permissions": [ | 31 <b>"permissions": [ |
| (...skipping 19 matching lines...) Expand all Loading... |
| 50 Chrome syncs the data. | 51 Chrome syncs the data. |
| 51 Even if a user disables syncing, | 52 Even if a user disables syncing, |
| 52 <code>storage.sync</code> will still work. | 53 <code>storage.sync</code> will still work. |
| 53 In this case, it will behave identically | 54 In this case, it will behave identically |
| 54 to <code>storage.local</code>. | 55 to <code>storage.local</code>. |
| 55 </p> | 56 </p> |
| 56 <p class="warning"> | 57 <p class="warning"> |
| 57 Confidential user information should not be stored! | 58 Confidential user information should not be stored! |
| 58 The storage area isn't encrypted. | 59 The storage area isn't encrypted. |
| 59 </p> | 60 </p> |
| 61 <p> |
| 62 The <code>storage.managed</code> is a read-only |
| 63 storage that contains settings configured by the |
| 64 domain administrator for the extension. Enforcing |
| 65 these settings allows administrators to configure |
| 66 your extension on enterprise deployments. |
| 67 </p> |
| 60 <h2 id="limits">Storage and throttling limits</h2> | 68 <h2 id="limits">Storage and throttling limits</h2> |
| 61 <p><code>chrome.storage</code> is not a big truck. | 69 <p><code>chrome.storage</code> is not a big truck. |
| 62 It's a series of tubes. | 70 It's a series of tubes. |
| 63 And if you don't understand, | 71 And if you don't understand, |
| 64 those tubes can be filled, | 72 those tubes can be filled, |
| 65 and if they are filled | 73 and if they are filled |
| 66 when you put your message in, | 74 when you put your message in, |
| 67 it gets in line, | 75 it gets in line, |
| 68 and it's going to be delayed | 76 and it's going to be delayed |
| 69 by anyone that puts into that tube | 77 by anyone that puts into that tube |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 key, | 122 key, |
| 115 namespace, | 123 namespace, |
| 116 storageChange.oldValue, | 124 storageChange.oldValue, |
| 117 storageChange.newValue); | 125 storageChange.newValue); |
| 118 } | 126 } |
| 119 }); | 127 }); |
| 120 </pre> | 128 </pre> |
| 121 <p> | 129 <p> |
| 122 You can find examples that use this API on the | 130 You can find examples that use this API on the |
| 123 <a href="samples.html#sty">Samples page</a>. | 131 <a href="samples.html#sty">Samples page</a>. |
| 124 </p> | 132 </p> |
| 125 <!-- END AUTHORED CONTENT --> | |
| OLD | NEW |