| Index: chrome/common/extensions/docs/server2/templates/intros/storage.html
|
| diff --git a/chrome/common/extensions/docs/server2/templates/intros/storage.html b/chrome/common/extensions/docs/server2/templates/intros/storage.html
|
| index 04b0e4b777cc4825b50706258c67a5dc589976a7..20d814985e029927e66dfa3ca7bbdcb41cf2a535 100644
|
| --- a/chrome/common/extensions/docs/server2/templates/intros/storage.html
|
| +++ b/chrome/common/extensions/docs/server2/templates/intros/storage.html
|
| @@ -1,4 +1,3 @@
|
| -<!-- BEGIN AUTHORED CONTENT -->
|
| <p id="classSummary">
|
| Use the <code>chrome.storage</code> module
|
| to store, retrieve, and track changes to user data.
|
| @@ -8,6 +7,7 @@ It provides the same storage capabilities as the
|
| <a href="https://developer.mozilla.org/en/DOM/Storage#localStorage">localStorage API</a>
|
| with the following key differences:
|
| </p>
|
| +
|
| <ul>
|
| <li>User data can be automatically synced with Chrome sync
|
| (using <code>storage.sync</code>).</li>
|
| @@ -18,7 +18,10 @@ with the following key differences:
|
| <a href="manifest.html#incognito">split incognito behavior</a>.</li>
|
| <li>User data can be stored as objects
|
| (the <code>localStorage API</code> stores data in strings).</li>
|
| + <li>Domain policies configured by the administrator for the extension
|
| + can be read (using <code>storage.managed</code>).</li>
|
| </ul>
|
| +
|
| <h2 id="manifest">Manifest</h2>
|
| <p>You must declare the "storage" permission in the <a
|
| href="manifest.html">extension manifest</a>
|
| @@ -32,7 +35,9 @@ with the following key differences:
|
| ]</b>,
|
| ...
|
| }</pre>
|
| +
|
| <h2 id="using-sync">Usage</h2>
|
| +
|
| <p>
|
| To store user data for your extension,
|
| you can use either
|
| @@ -43,6 +48,7 @@ the stored data will automatically be synced
|
| to any Chrome browser that the user is logged into,
|
| provided the user has sync enabled.
|
| </p>
|
| +
|
| <p>
|
| When Chrome is offline,
|
| Chrome stores the data locally.
|
| @@ -53,11 +59,22 @@ Even if a user disables syncing,
|
| In this case, it will behave identically
|
| to <code>storage.local</code>.
|
| </p>
|
| +
|
| <p class="warning">
|
| Confidential user information should not be stored!
|
| The storage area isn't encrypted.
|
| </p>
|
| +
|
| +<p>
|
| +The <code>storage.managed</code> is a read-only
|
| +storage that contains settings configured by the
|
| +domain administrator for the extension. Enforcing
|
| +these settings allows administrators to configure
|
| +your extension on enterprise deployments.
|
| +</p>
|
| +
|
| <h2 id="limits">Storage and throttling limits</h2>
|
| +
|
| <p><code>chrome.storage</code> is not a big truck.
|
| It's a series of tubes.
|
| And if you don't understand,
|
| @@ -68,17 +85,22 @@ it gets in line,
|
| and it's going to be delayed
|
| by anyone that puts into that tube
|
| enormous amounts of material.
|
| +
|
| <p>For details on the current limits
|
| of the storage API, and what happens
|
| when those limits are exceeded, please
|
| see the <a href="#apiReference">API reference</a>.
|
| +
|
| +
|
| <h2 id="examples">Examples</h2>
|
| +
|
| <p>
|
| The following example checks for
|
| CSS code saved by a user on a form,
|
| and if found,
|
| stores it.
|
| </p>
|
| +
|
| <pre>
|
| function saveChanges() {
|
| // Get a value saved in a form.
|
| @@ -95,6 +117,7 @@ function saveChanges() {
|
| });
|
| }
|
| </pre>
|
| +
|
| <p>
|
| If you're interested in tracking changes made
|
| to a data object,
|
| @@ -105,6 +128,7 @@ that event fires.
|
| Here's sample code
|
| to listen for saved changes:
|
| </p>
|
| +
|
| <pre>
|
| chrome.storage.onChanged.addListener(function(changes, namespace) {
|
| for (key in changes) {
|
| @@ -118,8 +142,8 @@ chrome.storage.onChanged.addListener(function(changes, namespace) {
|
| }
|
| });
|
| </pre>
|
| +
|
| <p>
|
| You can find examples that use this API on the
|
| <a href="samples.html#sty">Samples page</a>.
|
| -</p>
|
| -<!-- END AUTHORED CONTENT -->
|
| +</p>
|
|
|