| OLD | NEW |
| 1 <div id="pageData-name" class="pageData">BrowsingData API</div> | 1 <div id="pageData-name" class="pageData">BrowsingData API</div> |
| 2 | 2 |
| 3 <!-- BEGIN AUTHORED CONTENT --> | 3 <!-- BEGIN AUTHORED CONTENT --> |
| 4 <p id="classSummary"> | 4 <p id="classSummary"> |
| 5 Use the <code>chrome.browsingData</code> module to remove browsing data from a | 5 Use the <code>chrome.browsingData</code> module to remove browsing data from a |
| 6 user's local profile. | 6 user's local profile. |
| 7 </p> | 7 </p> |
| 8 | 8 |
| 9 <h2 id="manifest">Manifest</h2> | 9 <h2 id="manifest">Manifest</h2> |
| 10 | 10 |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 "since": oneWeekAgo | 79 "since": oneWeekAgo |
| 80 }, callback);</pre> | 80 }, callback);</pre> |
| 81 | 81 |
| 82 <p class="caution"> | 82 <p class="caution"> |
| 83 <strong>Important</strong>: Removing browsing data involves a good deal of | 83 <strong>Important</strong>: Removing browsing data involves a good deal of |
| 84 heavy lifting in the background, and can take <em>tens of seconds</em> to | 84 heavy lifting in the background, and can take <em>tens of seconds</em> to |
| 85 complete, depending on a user's profile. You should use the callback mechanism | 85 complete, depending on a user's profile. You should use the callback mechanism |
| 86 to keep your users up to date on the removal's status. | 86 to keep your users up to date on the removal's status. |
| 87 </p> | 87 </p> |
| 88 | 88 |
| 89 <h2 id="origin_types">Origin Types</h2> |
| 90 |
| 91 <p> |
| 92 Adding an <code>originType</code> property to the API's options object allows |
| 93 you to specify which types of origins ought to be effected. Currently, origins |
| 94 are divided into three categories: |
| 95 </p> |
| 96 <ul> |
| 97 <li> |
| 98 <code>unprotectedWeb</code> covers the general case of websites that users |
| 99 visit without taking any special action. If you don't specify an |
| 100 <code>originType</code>, the API defaults to removing data from unprotected |
| 101 web origins. |
| 102 </li> |
| 103 <li> |
| 104 <code>protectedWeb</code> covers those web origins that have been installed |
| 105 as hosted applications. Installing <a href="https://chrome.google.com/websto
re/detail/aknpkdffaafgjchaibgeefbgmgeghloj"> |
| 106 Angry Birds</a>, for example, protects the origin |
| 107 <code>http://chrome.angrybirds.com</code>, and removes it from the |
| 108 <code>unprotectedWeb</code> category. Please do be careful when triggering |
| 109 deletion of data for these origins: make sure your users know what they're |
| 110 getting, as this will irrevocably remove their game data. No one wants to |
| 111 knock tiny pig houses over more often than necessary. |
| 112 </li> |
| 113 <li> |
| 114 <code>extension</code> covers origins under the |
| 115 <code>chrome-extensions:</code> scheme. Removing extension data is, again, |
| 116 something you should be very careful about. |
| 117 </li> |
| 118 </ul> |
| 119 <p> |
| 120 We could adjust the previous example to remove only data from protected |
| 121 websites as follows: |
| 122 </p> |
| 123 <pre>var callback = function () { |
| 124 // Do something clever here once data has been removed. |
| 125 }; |
| 126 |
| 127 var millisecondsPerWeek = 1000 * 60 * 60 * 24 * 7; |
| 128 var oneWeekAgo = (new Date()).getTime() - millisecondsPerWeek; |
| 129 chrome.browsingData.remove({ |
| 130 "since": oneWeekAgo, |
| 131 <b>"originType": { |
| 132 "protectedWeb": true |
| 133 }</b> |
| 134 }, { |
| 135 "appcache": true, |
| 136 "cache": true, |
| 137 "cookies": true, |
| 138 "downloads": true, |
| 139 "fileSystems": true, |
| 140 "formData": true, |
| 141 "history": true, |
| 142 "indexedDB": true, |
| 143 "localStorage": true, |
| 144 "pluginData": true, |
| 145 "passwords": true, |
| 146 "webSQL": true |
| 147 }, callback);</pre> |
| 148 |
| 149 <p class="caution"> |
| 150 <strong>Seriously</strong>: Be careful with <code>protectedWeb</code> and |
| 151 <code>extension</code>. These are destructive operations that your users |
| 152 will write angry email about if they're not well-informed about what to |
| 153 expect when your extension removes data on their behalf. |
| 154 </p> |
| 155 |
| 89 <h2 id="samples">Examples</h2> | 156 <h2 id="samples">Examples</h2> |
| 90 <p> | 157 <p> |
| 91 Samples for the <code>browsingData</code> API are available | 158 Samples for the <code>browsingData</code> API are available |
| 92 <a href="http://code.google.com/chrome/extensions/trunk/samples.html#chrome.br
owsingData">on the samples page</a>. | 159 <a href="http://code.google.com/chrome/extensions/trunk/samples.html#chrome.br
owsingData">on the samples page</a>. |
| 93 </p> | 160 </p> |
| 94 | 161 |
| 95 <!-- END AUTHORED CONTENT --> | 162 <!-- END AUTHORED CONTENT --> |
| OLD | NEW |