Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: chrome/common/extensions/docs/static/experimental.browsingData.html

Issue 9424036: Move `browsingData` extension API out of experimental. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebuilt docs. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <div id="pageData-name" class="pageData">BrowsingData API</div> 1 <div id="pageData-name" class="pageData">experimental.browsingData</div>
2 2
3 <!-- BEGIN AUTHORED CONTENT --> 3 <p>
4 <p id="classSummary"> 4 The <code>BrowsingData</code> API is no longer experimental;
5 Use the <code>chrome.experimental.browsingData</code> module to remove 5 it's supported! You can read all about it at its new home:
6 browsing data from a user's local profile. This module is still experimental.
7 For more information regarding the usage of experimental APIs, see the
8 <a href="experimental.html">chrome.experimental.* APIs</a> page.
9 </p> 6 </p>
10 7
11 <h2 id="manifest">Manifest</h2> 8 <blockquote>
12 9 <a href="browsingData.html">chrome.browsingData</a>
13 <p> 10 </blockquote>
14 You must declare the "clear" permission in the
15 <a href="manifest.html">extension manifest</a> to use this API. As the API is
16 still experimental, you must declare the "experimental" permisson as well.
17 </p>
18
19 <pre>{
20 "name": "My extension",
21 ...
22 <b>"permissions": [
23 "browsingData",
24 "experimental"
25 ]</b>,
26 ...
27 }</pre>
28
29 <h2 id="usage">Usage</h2>
30
31 <p>
32 The simplest use-case for this API is a a time-based mechanism for clearing a
33 user's browsing data. Your code should provide a timestamp which indicates the
34 historical date after which the user's browsing data should be removed. This
35 timestamp is formatted as the number of milliseconds since the Unix epoch
36 (which can be retrieved from a JavaScript <code>Date</code> object via the
37 <code>getTime</code> method).
38 </p>
39
40 <p>
41 For example, to clear all of a user's browsing data from the last week, you
42 might write code as follows:
43 </p>
44
45 <pre>var callback = function () {
46 // Do something clever here once data has been removed.
47 };
48
49 var millisecondsPerWeek = 1000 * 60 * 60 * 24 * 7;
50 var oneWeekAgo = (new Date()).getTime() - millisecondsPerWeek;
51 chrome.experimental.browsingData.remove({
52 "since": oneWeekAgo
53 }, {
54 "appcache": true,
55 "cache": true,
56 "cookies": true,
57 "downloads": true,
58 "fileSystems": true,
59 "formData": true,
60 "history": true,
61 "indexedDB": true,
62 "localStorage": true,
63 "pluginData": true,
64 "passwords": true,
65 "webSQL": true
66 }, callback);</pre>
67
68 <p>
69 The <code>chrome.experimental.browsingData.remove</code> method allows you to
70 remove various types of browsing data with a single call, and will be much
71 faster than calling multiple more specific methods. If, however, you only
72 want to clear one specific type of browsing data (cookies, for example), the
73 more granular methods offer a readable alternative to a call filled with JSON.
74 </p>
75
76 <pre>var callback = function () {
77 // Do something clever here once data has been removed.
78 };
79
80 var millisecondsPerWeek = 1000 * 60 * 60 * 24 * 7;
81 var oneWeekAgo = (new Date()).getTime() - millisecondsPerWeek;
82 chrome.experimental.browsingData.removeCookies({
83 "since": oneWeekAgo
84 }, callback);</pre>
85
86 <p class="caution">
87 <strong>Important</strong>: Removing browsing data involves a good deal of
88 heavy lifting in the background, and can take <em>tens of seconds</em> to
89 complete, depending on a user's profile. You should use the callback mechanism
90 to keep your users up to date on the removal's status.
91 </p>
92
93 <h2 id="samples">Examples</h2>
94 <p>
95 Samples for the <code>browsingData</code> API are available
96 <a href="http://code.google.com/chrome/extensions/trunk/samples.html#chrome.ex perimental.browsingData">on the samples page</a>.
97 </p>
98
99 <!-- END AUTHORED CONTENT -->
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/static/browsingData.html ('k') | chrome/common/extensions/docs/tabs.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698