diff options
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/common/extensions/api/experimental.clear.json | 14 | ||||
-rw-r--r-- | chrome/common/extensions/docs/examples/api/clear/basic.zip | bin | 0 -> 9041 bytes | |||
-rw-r--r-- | chrome/common/extensions/docs/examples/api/clear/basic/icon.png | bin | 0 -> 2471 bytes | |||
-rw-r--r-- | chrome/common/extensions/docs/examples/api/clear/basic/manifest.json | 14 | ||||
-rw-r--r-- | chrome/common/extensions/docs/examples/api/clear/basic/popup.css | 66 | ||||
-rw-r--r-- | chrome/common/extensions/docs/examples/api/clear/basic/popup.html | 24 | ||||
-rw-r--r-- | chrome/common/extensions/docs/examples/api/clear/basic/popup.js | 132 | ||||
-rw-r--r-- | chrome/common/extensions/docs/examples/api/omnibox/simple-example.zip | bin | 2131 -> 1358 bytes | |||
-rw-r--r-- | chrome/common/extensions/docs/experimental.clear.html | 155 | ||||
-rw-r--r-- | chrome/common/extensions/docs/samples.html | 51 | ||||
-rw-r--r-- | chrome/common/extensions/docs/samples.json | 30 | ||||
-rw-r--r-- | chrome/common/extensions/docs/static/experimental.clear.html | 95 |
12 files changed, 550 insertions, 31 deletions
diff --git a/chrome/common/extensions/api/experimental.clear.json b/chrome/common/extensions/api/experimental.clear.json index 7c72510..5c9108d 100644 --- a/chrome/common/extensions/api/experimental.clear.json +++ b/chrome/common/extensions/api/experimental.clear.json @@ -11,7 +11,7 @@ "functions": [ { "name": "browsingData", - "description": "Clears data generated by browsing within a particular timeframe.", + "description": "Clears various types of browsing data stored in a user's profile.", "type": "function", "parameters": [ { @@ -31,7 +31,7 @@ "cache": { "type": "boolean", "optional": true, - "description": "Should the browser cache be cleared?" + "description": "Should the browser's cache be cleared? Note: this clears the <em>entire</em> cache: it is not limited to the range you specify." }, "cookies": { "type": "boolean", @@ -51,7 +51,7 @@ "formData": { "type": "boolean", "optional": true, - "description": "Should stored form data be cleared?" + "description": "Should the browser's stored form data be cleared?" }, "history": { "type": "boolean", @@ -132,7 +132,7 @@ }, { "name": "cookies", - "description": "Clears the browser's cookies.", + "description": "Clears the browser's cookies modified within a particular timeframe.", "type": "function", "parameters": [ { @@ -257,8 +257,8 @@ ] }, { - "name": "lsoData", - "description": "Clears plugins' Local Storage Object data.", + "name": "pluginData", + "description": "Clears plugins' data.", "type": "function", "parameters": [ { @@ -268,7 +268,7 @@ { "name": "callback", "type": "function", - "description": "Called when plugins' Local Storage Data has been cleared.", + "description": "Called when plugins' data has been cleared.", "optional": true, "parameters": [] } diff --git a/chrome/common/extensions/docs/examples/api/clear/basic.zip b/chrome/common/extensions/docs/examples/api/clear/basic.zip Binary files differnew file mode 100644 index 0000000..86509e2 --- /dev/null +++ b/chrome/common/extensions/docs/examples/api/clear/basic.zip diff --git a/chrome/common/extensions/docs/examples/api/clear/basic/icon.png b/chrome/common/extensions/docs/examples/api/clear/basic/icon.png Binary files differnew file mode 100644 index 0000000..346e1fd --- /dev/null +++ b/chrome/common/extensions/docs/examples/api/clear/basic/icon.png diff --git a/chrome/common/extensions/docs/examples/api/clear/basic/manifest.json b/chrome/common/extensions/docs/examples/api/clear/basic/manifest.json new file mode 100644 index 0000000..18fb698 --- /dev/null +++ b/chrome/common/extensions/docs/examples/api/clear/basic/manifest.json @@ -0,0 +1,14 @@ +{ + "name" : "Clear API: Basics", + "version" : "1.0", + "description" : "A trivial usage example.", + "permissions": [ + "clear", + "experimental" + ], + "browser_action": { + "default_icon": "icon.png", + "popup": "popup.html" + }, + "manifest_version": 2 +} diff --git a/chrome/common/extensions/docs/examples/api/clear/basic/popup.css b/chrome/common/extensions/docs/examples/api/clear/basic/popup.css new file mode 100644 index 0000000..8d4ae08 --- /dev/null +++ b/chrome/common/extensions/docs/examples/api/clear/basic/popup.css @@ -0,0 +1,66 @@ +body { + margin: 5px 10px 10px; +} + +h1 { + color: #53637D; + font: 26px/1.2 Helvetica, sans-serif; + font-size: 200%; + margin: 0; + padding-bottom: 4px; + text-shadow: white 0 1px 2px; +} + +label { + color: #222; + font: 18px/1.4 Helvetica, sans-serif; + margin: 0.5em 0; + display: inline-block; +} + +form { + width: 563px; + -webkit-transition: -webkit-transform 0.25s ease; +} + +button { + display: block; + border-radius: 2px; + box-shadow: 0px 1px 3px rgba(0, 0, 0, 0.1); + -webkit-user-select: none; + background: -webkit-linear-gradient(#FAFAFA, #F4F4F4 40%, #E5E5E5); + border: 1px solid #AAA; + color: #444; + margin-bottom: 0; + min-width: 4em; + padding: 3px 12px; + margin-top: 0; + font-size: 1.1em; +} + +.overlay { + display: block; + text-align: center; + position: absolute; + left: 50%; + top: 50%; + width: 500px; + padding: 20px; + margin: -40px 0 0 -270px; + opacity: 0; + background: rgba(0, 0, 0, 0.75); + border-radius: 5px; + color: #FFF; + font: 1.5em/1.2 Helvetica Neue, sans-serif; + -webkit-transition: all 1.0s ease; + -webkit-transform: scale(0); +} + +.overlay a { + color: #FFF; +} + +.overlay.visible { + opacity: 1; + -webkit-transform: scale(1); +} diff --git a/chrome/common/extensions/docs/examples/api/clear/basic/popup.html b/chrome/common/extensions/docs/examples/api/clear/basic/popup.html new file mode 100644 index 0000000..c4daf02 --- /dev/null +++ b/chrome/common/extensions/docs/examples/api/clear/basic/popup.html @@ -0,0 +1,24 @@ +<!DOCTYPE html> +<html> + <head> + <title>Popup</title> + <link href="popup.css" rel="stylesheet"> + <script src="popup.js"></script> + </head> + <body> + <h1>Clear API Sample</h1> + <div role="main"> + <form> + <label for="timeframe">Remove all browsing data from:</label> + <select id="timeframe"> + <option value="hour">the past hour</option> + <option value="day">the past day</option> + <option value="week">the past week</option> + <option value="4weeks">the past four weeks</option> + <option value="forever">the beginning of time</option> + </select> + <button id="button">OBLITERATE!</button> + </form> + </div> + </body> +</html> diff --git a/chrome/common/extensions/docs/examples/api/clear/basic/popup.js b/chrome/common/extensions/docs/examples/api/clear/basic/popup.js new file mode 100644 index 0000000..a17cf3d --- /dev/null +++ b/chrome/common/extensions/docs/examples/api/clear/basic/popup.js @@ -0,0 +1,132 @@ +// 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. + +/** + * This class wraps the popup's form, and performs the proper clearing of data + * based on the user's selections. It depends on the form containing a single + * select element with an id of 'timeframe', and a single button with an id of + * 'button'. When you write actual code you should probably be a little more + * accepting of variance, but this is just a sample app. :) + * + * Most of this is boilerplate binding the controller to the UI. The bits that + * specifically will be useful when using the Clear API are contained in + * `parseMilliseconds_`, `handleCallback_`, and `handleClick_`. + * + * @constructor + */ +var PopupController = function () { + this.button_ = document.getElementById('button'); + this.timeframe_ = document.getElementById('timeframe'); + this.addListeners_(); +}; + +PopupController.prototype = { + /** + * A cached reference to the button element. + * + * @type {Element} + * @private + */ + button_: null, + + /** + * A cached reference to the select element. + * + * @type {Element} + * @private + */ + timeframe_: null, + + /** + * Adds event listeners to the button in order to capture a user's click, and + * perform some action in response. + * + * @private + */ + addListeners_: function () { + this.button_.addEventListener('click', this.handleClick_.bind(this)); + }, + + /** + * Given a string, return milliseconds since epoch. If the string isn't + * valid, returns undefined. + * + * @param {string} timeframe One of 'hour', 'day', 'week', '4weeks', or + * 'forever'. + * @returns {number} Milliseconds since epoch. + * @private + */ + parseMilliseconds_: function (timeframe) { + var now = new Date().getTime(); + var milliseconds = { + 'hour': 60 * 60 * 1000, + 'day': 24 * 60 * 60 * 1000, + 'week': 7 * 24 * 60 * 60 * 1000, + '4weeks': 4 * 7 * 24 * 60 * 60 * 1000 + }; + + if (milliseconds[timeframe]) + return now - milliseconds[timeframe]; + + if (timeframe === 'forever') + return 0; + + return null; + }, + + /** + * Handle a success/failure callback from the `clear` API methods, updating + * the UI appropriately. + * + * @private + */ + handleCallback_: function () { + var success = document.createElement('div'); + success.classList.add('overlay'); + success.setAttribute('role', 'alert'); + success.textContent = 'Data has been cleared.'; + document.body.appendChild(success); + + setTimeout(function() { success.classList.add('visible'); }, 10); + setTimeout(function() { + if (close === false) + success.classList.remove('visible'); + else + window.close(); + }, 4000); + }, + + /** + * When a user clicks the button, this method is called: it reads the current + * state of `timeframe_` in order to pull a timeframe, then calls the clearing + * method with appropriate arguments. + * + * @private + */ + handleClick_: function () { + var removal_start = this.parseMilliseconds_(this.timeframe_.value); + if (removal_start !== undefined) { + this.button_.setAttribute('disabled', 'disabled'); + this.button_.innerText = 'Clearing...'; + chrome.experimental.clear.browsingData(removal_start, { + "appcache": true, + "cache": true, + "cookies": true, + "downloads": true, + "fileSystems": true, + "formData": true, + "history": true, + "indexedDB": true, + "localStorage": true, + "pluginData": true, + "passwords": true, + "webSQL": true + }, this.handleCallback_.bind(this)); + } + } +}; + +document.addEventListener('DOMContentLoaded', function () { + window.PC = new PopupController(); +}); diff --git a/chrome/common/extensions/docs/examples/api/omnibox/simple-example.zip b/chrome/common/extensions/docs/examples/api/omnibox/simple-example.zip Binary files differindex 8f0599f..a668242 100644 --- a/chrome/common/extensions/docs/examples/api/omnibox/simple-example.zip +++ b/chrome/common/extensions/docs/examples/api/omnibox/simple-example.zip diff --git a/chrome/common/extensions/docs/experimental.clear.html b/chrome/common/extensions/docs/experimental.clear.html index 0d44787..3771902 100644 --- a/chrome/common/extensions/docs/experimental.clear.html +++ b/chrome/common/extensions/docs/experimental.clear.html @@ -16,7 +16,7 @@ <script type="text/javascript" src="js/api_page_generator.js"></script> <script type="text/javascript" src="js/bootstrap.js"></script> <script type="text/javascript" src="js/sidebar.js"></script> - <meta name="description" content="Documentation for the chrome.experimental.clear module, which is part of the Google Chrome extension APIs."><title>chrome.experimental.clear - Google Chrome Extensions - Google Code</title></head> + <meta name="description" content="Documentation for the chrome.experimental.clear module, which is part of the Google Chrome extension APIs."><title>Clear API - Google Chrome Extensions - Google Code</title></head> <body> <div id="gc-container" class="labs"> <div id="devModeWarning"> You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files. @@ -294,16 +294,30 @@ <div class="g-unit" id="gc-pagecontent"> <div id="pageTitle"> - <h1 class="page_title">chrome.experimental.clear</h1> + <h1 class="page_title">Clear API</h1> </div> <!-- TABLE OF CONTENTS --> <div id="toc"> <h2>Contents</h2> <ol> - <li style="display: none; "> - <a>h2Name</a> + <li> + <a href="#manifest">Manifest</a> <ol> - <li> + <li style="display: none; "> + <a>h3Name</a> + </li> + </ol> + </li><li> + <a href="#usage">Usage</a> + <ol> + <li style="display: none; "> + <a>h3Name</a> + </li> + </ol> + </li><li> + <a href="#samples">Examples</a> + <ol> + <li style="display: none; "> <a>h3Name</a> </li> </ol> @@ -343,10 +357,10 @@ </li><li> <a href="#method-localStorage">localStorage</a> </li><li> - <a href="#method-lsoData">lsoData</a> - </li><li> <a href="#method-passwords">passwords</a> </li><li> + <a href="#method-pluginData">pluginData</a> + </li><li> <a href="#method-webSQL">webSQL</a> </li> </ol> @@ -392,12 +406,107 @@ <!-- /TABLE OF CONTENTS --> <!-- Standard content lead-in for experimental API pages --> - <p id="classSummary"> + <p id="classSummary" style="display: none; "> For information on how to use experimental APIs, see the <a href="experimental.html">chrome.experimental.* APIs</a> page. </p> <!-- STATIC CONTENT PLACEHOLDER --> - <div id="static"></div> + <div id="static"><div id="pageData-name" class="pageData">Clear API</div> + +<!-- BEGIN AUTHORED CONTENT --> +<p id="classSummary"> + Use the <code>chrome.experimental.clear</code> module to remove browsing data + from a user's local profile. This module is still experimental. For more + information regarding the usage of experimental APIs, see the + <a href="experimental.html">chrome.experimental.* APIs</a> page. +</p> + +<h2 id="manifest">Manifest</h2> + +<p> + You must declare the "clear" permission in the + <a href="manifest.html">extension manifest</a> to use this API. As the API is + still experimental, you must declare the "experimental" permisson as well. +</p> + +<pre>{ + "name": "My extension", + ... + <b>"permissions": [ + "clear", + "experimental" + ]</b>, + ... +}</pre> + +<h2 id="usage">Usage</h2> + +<p> + This API provides a time-based mechanism for clearing a user's browsing data. + Your code should provide a timestamp which indicates the historical date after + which the user's browsing data should be removed. This timestamp is formatted + as the number of milliseconds since the Unix epoch (which can be retrieved + from a JavaScript <code>Date</code> object via the <code>getTime</code> + method). +</p> + +<p> + For example, to clear all of a user's browsing data from the last week, you + might write code as follows: +</p> + +<pre>var callback = function () { + // Do something clever here once data has been removed. +}; + +var millisecondsPerWeek = 1000 * 60 * 60 * 24 * 7; +var oneWeekAgo = (new Date()).getTime() - millisecondsPerWeek; +chrome.experimental.clear.browsingData(oneWeekAgo, { + "appcache": true, + "cache": true, + "cookies": true, + "downloads": true, + "fileSystems": true, + "formData": true, + "history": true, + "indexedDB": true, + "localStorage": true, + "pluginData": true, + "passwords": true, + "webSQL": true +}, callback);</pre> + +<p> + The <code>chrome.experimental.clear.browsingData</code> method allows you to + remove various types of browsing data with a single call, and will be much + faster than calling multiple more specific methods. If, however, you only + want to clear one specific type of browsing data (cookies, for example), the + more granular methods offer a readable alternative to a call filled with JSON. +</p> + +<pre>var callback = function () { + // Do something clever here once data has been removed. +}; + +var millisecondsPerWeek = 1000 * 60 * 60 * 24 * 7; +var oneWeekAgo = (new Date()).getTime() - millisecondsPerWeek; +chrome.experimental.clear.cookies(oneWeekAgo, callback);</pre> + +<p class="caution"> + <strong>Important</strong>: Removing browsing data involves a good deal of + heavy lifting in the background, and can take <em>tens of seconds</em> to + complete, depending on a user's profile. You should use the callback mechanism + to keep your users up to date on the removal's status. +</p> + +<h2 id="samples">Examples</h2> +<p> + Samples for the <code>clear</code> API are available + <a href="http://code.google.com/chrome/extensions/trunk/samples.html#chrome.experimental.clear">on the samples page</a>. +</p> + +<!-- END AUTHORED CONTENT --> +</div> <!-- API PAGE --> <div class="apiPage"> @@ -641,7 +750,7 @@ <div class="description"> <p class="todo" style="display: none; ">Undocumented.</p> - <p>Clears data generated by browsing within a particular timeframe.</p> + <p>Clears various types of browsing data stored in a user's profile.</p> <!-- PARAMETERS --> <h4>Parameters</h4> @@ -860,7 +969,7 @@ <dd class="todo" style="display: none; "> Undocumented. </dd> - <dd>Should the browser cache be cleared?</dd> + <dd>Should the browser's cache be cleared? Note: this clears the <em>entire</em> cache: it is not limited to the range you specify.</dd> <dd style="display: none; "> This parameter was added in version <b><span></span></b>. @@ -1132,7 +1241,7 @@ <dd class="todo" style="display: none; "> Undocumented. </dd> - <dd>Should stored form data be cleared?</dd> + <dd>Should the browser's stored form data be cleared?</dd> <dd style="display: none; "> This parameter was added in version <b><span></span></b>. @@ -1922,7 +2031,7 @@ <div class="description"> <p class="todo" style="display: none; ">Undocumented.</p> - <p>Clears the browser's cookies.</p> + <p>Clears the browser's cookies modified within a particular timeframe.</p> <!-- PARAMETERS --> <h4>Parameters</h4> @@ -3311,18 +3420,18 @@ </div> <!-- /description --> </div><div class="apiItem"> - <a name="method-lsoData"></a> <!-- method-anchor --> - <h4>lsoData</h4> + <a name="method-passwords"></a> <!-- method-anchor --> + <h4>passwords</h4> <div class="summary"><span style="display: none; ">void</span> <!-- Note: intentionally longer 80 columns --> - <span>chrome.experimental.clear.lsoData</span>(<span class="null"><span style="display: none; ">, </span><span>RemovalRange</span> + <span>chrome.experimental.clear.passwords</span>(<span class="null"><span style="display: none; ">, </span><span>RemovalRange</span> <var><span>since</span></var></span><span class="optional"><span>, </span><span>function</span> <var><span>callback</span></var></span>)</div> <div class="description"> <p class="todo" style="display: none; ">Undocumented.</p> - <p>Clears plugins' Local Storage Object data.</p> + <p>Clears the browser's stored passwords.</p> <!-- PARAMETERS --> <h4>Parameters</h4> @@ -3428,7 +3537,7 @@ <dd class="todo" style="display: none; "> Undocumented. </dd> - <dd>Called when plugins' Local Storage Data has been cleared.</dd> + <dd>Called when the browser's passwords have been cleared.</dd> <dd style="display: none; "> This parameter was added in version <b><span></span></b>. @@ -3511,18 +3620,18 @@ </div> <!-- /description --> </div><div class="apiItem"> - <a name="method-passwords"></a> <!-- method-anchor --> - <h4>passwords</h4> + <a name="method-pluginData"></a> <!-- method-anchor --> + <h4>pluginData</h4> <div class="summary"><span style="display: none; ">void</span> <!-- Note: intentionally longer 80 columns --> - <span>chrome.experimental.clear.passwords</span>(<span class="null"><span style="display: none; ">, </span><span>RemovalRange</span> + <span>chrome.experimental.clear.pluginData</span>(<span class="null"><span style="display: none; ">, </span><span>RemovalRange</span> <var><span>since</span></var></span><span class="optional"><span>, </span><span>function</span> <var><span>callback</span></var></span>)</div> <div class="description"> <p class="todo" style="display: none; ">Undocumented.</p> - <p>Clears the browser's stored passwords.</p> + <p>Clears plugins' data.</p> <!-- PARAMETERS --> <h4>Parameters</h4> @@ -3628,7 +3737,7 @@ <dd class="todo" style="display: none; "> Undocumented. </dd> - <dd>Called when the browser's passwords have been cleared.</dd> + <dd>Called when plugins' data has been cleared.</dd> <dd style="display: none; "> This parameter was added in version <b><span></span></b>. diff --git a/chrome/common/extensions/docs/samples.html b/chrome/common/extensions/docs/samples.html index b834156..f614553 100644 --- a/chrome/common/extensions/docs/samples.html +++ b/chrome/common/extensions/docs/samples.html @@ -345,6 +345,7 @@ "0e790e035a4a00b6f1def5ef9a7d7be1bce95ab5": "CHROMIUM BUILDBOT MONITOR DISPLAYS THE STATUS OF THE CHROMIUM BUILDBOT IN THE TOOLBAR. CLICK TO SEE MORE DETAILED STATUS IN A POPUP. BACKGROUND_PAGE BROWSER_ACTION NOTIFICATIONS OPTIONS_PAGE CHROME.BROWSERACTION.SETBADGEBACKGROUNDCOLOR CHROME.BROWSERACTION.SETBADGETEXT CHROME.BROWSERACTION.SETTITLE CHROME.EXTENSION.GETURL", "ac31228200b41a87982e386cc90d3a6eee4ad885": "CHROMIUM SEARCH ADD SUPPORT TO THE OMNIBOX TO SEARCH THE CHROMIUM SOURCE CODE. BACKGROUND_PAGE TABS CHROME.OMNIBOX.ONINPUTCANCELLED CHROME.OMNIBOX.ONINPUTCHANGED CHROME.OMNIBOX.ONINPUTENTERED CHROME.OMNIBOX.ONINPUTSTARTED CHROME.OMNIBOX.SETDEFAULTSUGGESTION CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.UPDATE", "7d5d6cf195bc25480256618e360aa38c6e6fba82": "CLD DISPLAYS THE LANGUAGE OF A TAB BACKGROUND_PAGE BROWSER_ACTION TABS CHROME.BROWSERACTION.SETBADGETEXT CHROME.TABS.DETECTLANGUAGE CHROME.TABS.GET CHROME.TABS.GETSELECTED CHROME.TABS.ONSELECTIONCHANGED CHROME.TABS.ONUPDATED", + "b745d48df80e88222d7344efe7c19e03fd8202f4": "CLEAR API: BASICS A TRIVIAL USAGE EXAMPLE. BROWSER_ACTION CLEAR EXPERIMENTAL POPUP CHROME.EXPERIMENTAL.CLEAR.BROWSINGDATA", "6871d09f4a96bf9d4b6cc724d00e909cee0f3902": "CONTENT SCRIPT CROSS-DOMAIN XMLHTTPREQUEST EXAMPLE DEMONSTRATES MAKING CROSS DOMAIN REQUESTS FROM A CONTENT SCRIPT BY PUTTING TWITTER TRENDS ON GOOGLE NEWS.", "e1f97e61e28ff33131d66dd28a4ed70a77874a51": "CONTENT SETTINGS SHOWS THE CONTENT SETTINGS FOR THE CURRENT SITE. BROWSER_ACTION CONTENTSETTINGS TABS CHROME.TABS.GET CHROME.TABS.GETSELECTED", "5d81304a17cf7ac2887484f730fbd2b01e51e166": "CONTEXT MENUS SAMPLE SHOWS SOME OF THE FEATURES OF THE CONTEXT MENUS API BACKGROUND_PAGE CONTEXTMENUS CHROME.CONTEXTMENUS.CREATE", @@ -1273,6 +1274,56 @@ - <a>Install extension</a> </span> </div> +</div><div class="sample" id="b745d48df80e88222d7344efe7c19e03fd8202f4"> + <img class="icon" style="display: none; "> + <img class="icon" src="images/sample-default-icon.png"> + <h2 class="name"> + <a href="#b745d48df80e88222d7344efe7c19e03fd8202f4">Clear API: Basics</a> + <span style="display: none; ">(packaged app)</span> + </h2> + <p class="metadata features">Uses + <span> + <strong>browser_action</strong><span>, </span> + <span style="display: none; "> and</span> + </span><span> + <strong>clear</strong><span>, </span> + <span style="display: none; "> and</span> + </span><span> + <strong>experimental</strong><span style="display: none; ">, </span> + <span> and</span> + </span><span> + <strong>popup</strong><span style="display: none; ">, </span> + <span style="display: none; "> and</span> + </span> + </p> + <p>A trivial usage example.</p> + <div class="apicalls"><strong>Calls:</strong> + <ul> + <li> + <code><a href="experimental.clear.html#method-browsingData">chrome.experimental.clear.browsingData</a></code> + </li> + </ul> + </div> + <div class="sourcefiles"><strong>Source files:</strong> + <ul> + <li> + <code><a target="_blank" href="examples/api/clear/basic/manifest.json">manifest.json</a></code> + </li><li> + <code><a target="_blank" href="examples/api/clear/basic/popup.css">popup.css</a></code> + </li><li> + <code><a target="_blank" href="examples/api/clear/basic/popup.html">popup.html</a></code> + </li><li> + <code><a target="_blank" href="examples/api/clear/basic/popup.js">popup.js</a></code> + </li> + </ul> + </div> + <div> + <a href="examples/api/clear/basic.zip">Download source</a> + <!-- Only show the Install CRX link if a CRX file is provided --> + <span style="display: none; "> + - <a>Install extension</a> + </span> + </div> </div><div class="sample" id="6871d09f4a96bf9d4b6cc724d00e909cee0f3902"> <img class="icon" src="examples/howto/contentscript_xhr/sample-128.png"> <img class="icon" src="images/sample-default-icon.png" style="display: none; "> diff --git a/chrome/common/extensions/docs/samples.json b/chrome/common/extensions/docs/samples.json index aeb45eb..b08ab61 100644 --- a/chrome/common/extensions/docs/samples.json +++ b/chrome/common/extensions/docs/samples.json @@ -55,8 +55,8 @@ "chrome.experimental.clear.history": "experimental.clear.html#method-history", "chrome.experimental.clear.indexedDB": "experimental.clear.html#method-indexedDB", "chrome.experimental.clear.localStorage": "experimental.clear.html#method-localStorage", - "chrome.experimental.clear.lsoData": "experimental.clear.html#method-lsoData", "chrome.experimental.clear.passwords": "experimental.clear.html#method-passwords", + "chrome.experimental.clear.pluginData": "experimental.clear.html#method-pluginData", "chrome.experimental.clear.webSQL": "experimental.clear.html#method-webSQL", "chrome.experimental.devtools.audits.addCategory": "experimental.devtools.audits.html#method-addCategory", "chrome.experimental.devtools.console.addMessage": "experimental.devtools.console.html#method-addMessage", @@ -685,6 +685,34 @@ "zip_path": "examples\/api\/i18n\/cld.zip" }, { + "api_calls": [ + "chrome.experimental.clear.browsingData" + ], + "crx_path": null, + "description": "A trivial usage example.", + "features": [ + "browser_action", + "clear", + "experimental", + "popup" + ], + "icon": null, + "id": "b745d48df80e88222d7344efe7c19e03fd8202f4", + "name": "Clear API: Basics", + "packaged_app": false, + "path": "examples\/api\/clear\/basic\/", + "protocols": [], + "search_string": "CLEAR API: BASICS A TRIVIAL USAGE EXAMPLE. BROWSER_ACTION CLEAR EXPERIMENTAL POPUP CHROME.EXPERIMENTAL.CLEAR.BROWSINGDATA", + "source_files": [ + "manifest.json", + "popup.css", + "popup.html", + "popup.js" + ], + "source_hash": "d2edfcb8636c176c4c8508bcbc5f45f56b574464", + "zip_path": "examples\/api\/clear\/basic.zip" + }, + { "api_calls": [], "crx_path": null, "description": "Demonstrates making cross domain requests from a content script by putting Twitter trends on Google News.", diff --git a/chrome/common/extensions/docs/static/experimental.clear.html b/chrome/common/extensions/docs/static/experimental.clear.html new file mode 100644 index 0000000..3707fb0 --- /dev/null +++ b/chrome/common/extensions/docs/static/experimental.clear.html @@ -0,0 +1,95 @@ +<div id="pageData-name" class="pageData">Clear API</div> + +<!-- BEGIN AUTHORED CONTENT --> +<p id="classSummary"> + Use the <code>chrome.experimental.clear</code> module to remove browsing data + from a user's local profile. This module is still experimental. For more + information regarding the usage of experimental APIs, see the + <a href="experimental.html">chrome.experimental.* APIs</a> page. +</p> + +<h2 id="manifest">Manifest</h2> + +<p> + You must declare the "clear" permission in the + <a href="manifest.html">extension manifest</a> to use this API. As the API is + still experimental, you must declare the "experimental" permisson as well. +</p> + +<pre>{ + "name": "My extension", + ... + <b>"permissions": [ + "clear", + "experimental" + ]</b>, + ... +}</pre> + +<h2 id="usage">Usage</h2> + +<p> + This API provides a time-based mechanism for clearing a user's browsing data. + Your code should provide a timestamp which indicates the historical date after + which the user's browsing data should be removed. This timestamp is formatted + as the number of milliseconds since the Unix epoch (which can be retrieved + from a JavaScript <code>Date</code> object via the <code>getTime</code> + method). +</p> + +<p> + For example, to clear all of a user's browsing data from the last week, you + might write code as follows: +</p> + +<pre>var callback = function () { + // Do something clever here once data has been removed. +}; + +var millisecondsPerWeek = 1000 * 60 * 60 * 24 * 7; +var oneWeekAgo = (new Date()).getTime() - millisecondsPerWeek; +chrome.experimental.clear.browsingData(oneWeekAgo, { + "appcache": true, + "cache": true, + "cookies": true, + "downloads": true, + "fileSystems": true, + "formData": true, + "history": true, + "indexedDB": true, + "localStorage": true, + "pluginData": true, + "passwords": true, + "webSQL": true +}, callback);</pre> + +<p> + The <code>chrome.experimental.clear.browsingData</code> method allows you to + remove various types of browsing data with a single call, and will be much + faster than calling multiple more specific methods. If, however, you only + want to clear one specific type of browsing data (cookies, for example), the + more granular methods offer a readable alternative to a call filled with JSON. +</p> + +<pre>var callback = function () { + // Do something clever here once data has been removed. +}; + +var millisecondsPerWeek = 1000 * 60 * 60 * 24 * 7; +var oneWeekAgo = (new Date()).getTime() - millisecondsPerWeek; +chrome.experimental.clear.cookies(oneWeekAgo, callback);</pre> + +<p class="caution"> + <strong>Important</strong>: Removing browsing data involves a good deal of + heavy lifting in the background, and can take <em>tens of seconds</em> to + complete, depending on a user's profile. You should use the callback mechanism + to keep your users up to date on the removal's status. +</p> + +<h2 id="samples">Examples</h2> +<p> + Samples for the <code>clear</code> API are available + <a href="http://code.google.com/chrome/extensions/trunk/samples.html#chrome.experimental.clear">on the samples page</a>. +</p> + +<!-- END AUTHORED CONTENT --> |