Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <div id="pageData-name" class="pageData">Privacy</div> | |
| 2 | |
| 3 <!-- BEGIN AUTHORED CONTENT --> | |
| 4 <p id="classSummary"> | |
| 5 Use the <code>chrome.privacy</code> module to control usage of the features in | |
| 6 Chrome that can affect a user's privacy. This module relies on the | |
| 7 <a href="types.html#ChromeSetting">ChromeSetting prototype of the type API</a> | |
| 8 for getting and setting Chrome's configuration. | |
| 9 </p> | |
| 10 | |
| 11 <p class="note"> | |
| 12 The <a href="http://www.google.com/intl/en/landing/chrome/google-chrome-privac y-whitepaper.pdf">Chrome Privacy Whitepaper</a> | |
| 13 gives background detail regarding the features which this API can control. | |
|
mkearney
2012/01/19 23:48:25
This doc doesn't cover all the features - is it wo
Mike West
2012/01/20 11:12:20
There's a new version of the whitepaper in legal/P
| |
| 14 </p> | |
| 15 | |
| 16 <h2 id="manifest">Manifest</h2> | |
| 17 <p> | |
| 18 You must declare the "privacy" permission in your extension's | |
| 19 <a href="manifest.html"> manifest</a> to use the API. For example: | |
| 20 </p> | |
| 21 | |
| 22 <pre>{ | |
| 23 "name": "My extension", | |
| 24 ... | |
| 25 <b>"permissions": [ | |
| 26 "privacy" | |
| 27 ]</b>, | |
| 28 ... | |
| 29 }</pre> | |
| 30 | |
| 31 <h2 id="usage">Usage</h2> | |
| 32 | |
| 33 <p> | |
| 34 Reading the current value of a setting is straightforward. You'll first need | |
| 35 to find the property you're interested in, then you'll call <code>get()</code> | |
|
mkearney
2012/01/19 23:48:25
Small - can we add a Chrome here: 'current value o
Mike West
2012/01/20 11:12:20
Done.
| |
| 36 on that object in order to retrieve it's current value and your extension's | |
| 37 level of control. For example, to determine if Chrome's Autofill feature is | |
| 38 enabled, you'd write: | |
| 39 </p> | |
| 40 | |
| 41 <pre>chrome.privacy.services.autofillEnabled.get({}, function(details) { | |
| 42 if (details.value) | |
| 43 console.log('Autofill is on!'); | |
| 44 else | |
| 45 console.log('Autofill is off!'); | |
| 46 });</pre> | |
| 47 | |
| 48 <p> | |
| 49 Changing the value of a setting is a little bit more complex, simply because | |
| 50 you first must verify that your extension can control the setting. If the | |
| 51 setting has been locked down by enterprise policy, or already been set by | |
|
mkearney
2012/01/19 23:48:25
Small grammar fix - 'already been set' is better a
Mike West
2012/01/20 11:12:20
I don't like the way that sounds, honestly. I thin
| |
| 52 another extension, then your extension will be denied write access. You'll | |
| 53 use the <code>get()</code> method to determine your level of access, and then | |
| 54 call <code>set()</code> if your extension can grab control over the setting: | |
| 55 </p> | |
|
mkearney
2012/01/19 23:48:25
Question: does one extension have more control ove
Mike West
2012/01/20 11:12:20
The pecking order is well-defined by the Content S
| |
| 56 | |
| 57 <pre>chrome.privacy.services.autofillEnabled.get({}, function(details) { | |
| 58 if (details.levelOfControl === 'controllable_by_this_extension') { | |
| 59 chrome.privacy.services.autofillEnabled.set({ value: true }, function() { | |
| 60 if (chrome.extension.lastError === undefined) | |
| 61 console.log("Hooray, it worked!"); | |
| 62 else | |
| 63 console.log("Sadness!", chrome.extension.lastError); | |
| 64 } | |
| 65 } | |
| 66 });</pre> | |
| 67 | |
| 68 <h2 id="examples">Examples</h2> | |
| 69 <p> | |
| 70 For example code, see the | |
| 71 <a href="samples.html#privacy">Privacy API samples</a>. | |
| 72 </p> | |
| 73 <!-- END AUTHORED CONTENT --> | |
| OLD | NEW |