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

Side by Side Diff: chrome/common/extensions/docs/server2/templates/intros/privacy.html

Issue 10832042: Extensions Docs Server: Doc conversion script (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: script/build.py fixes Created 8 years, 4 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 <!-- BEGIN AUTHORED CONTENT -->
2 <p id="classSummary"> 1 <p id="classSummary">
3 Use the <code>chrome.privacy</code> module to control usage of the features in 2 Use the <code>chrome.privacy</code> module to control usage of the features in
4 Chrome that can affect a user's privacy. This module relies on the 3 Chrome that can affect a user's privacy. This module relies on the
5 <a href="types.html#ChromeSetting">ChromeSetting prototype of the type API</a> 4 <a href="types.html#ChromeSetting">ChromeSetting prototype of the type API</a>
6 for getting and setting Chrome's configuration. 5 for getting and setting Chrome's configuration.
7 </p> 6 </p>
8 <p class="note"> 7 <p class="note">
9 The <a href="http://www.google.com/intl/en/landing/chrome/google-chrome-privac y-whitepaper.pdf">Chrome Privacy Whitepaper</a> 8 The <a href="http://www.google.com/intl/en/landing/chrome/google-chrome-privac y-whitepaper.pdf">Chrome Privacy Whitepaper</a>
10 gives background detail regarding the features which this API can control. 9 gives background detail regarding the features which this API can control.
11 </p> 10 </p>
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 function (details) { 81 function (details) {
83 // The new value is stored in `details.value`, the new level of control 82 // The new value is stored in `details.value`, the new level of control
84 // in `details.levelOfControl`, and `details.incognitoSpecific` will be 83 // in `details.levelOfControl`, and `details.incognitoSpecific` will be
85 // `true` if the value is specific to Incognito mode. 84 // `true` if the value is specific to Incognito mode.
86 });</pre> 85 });</pre>
87 <h2 id="examples">Examples</h2> 86 <h2 id="examples">Examples</h2>
88 <p> 87 <p>
89 For example code, see the 88 For example code, see the
90 <a href="samples.html#privacy">Privacy API samples</a>. 89 <a href="samples.html#privacy">Privacy API samples</a>.
91 </p> 90 </p>
91 <p id="classSummary">
92 Use the <code>chrome.privacy</code> module to control usage of the features in
93 Chrome that can affect a user's privacy. This module relies on the
94 <a href="types.html#ChromeSetting">ChromeSetting prototype of the type API</a>
95 for getting and setting Chrome's configuration.
96 </p>
97 <p class="note">
98 The <a href="http://www.google.com/intl/en/landing/chrome/google-chrome-privac y-whitepaper.pdf">Chrome Privacy Whitepaper</a>
99 gives background detail regarding the features which this API can control.
100 </p>
101 <h2 id="manifest">Manifest</h2>
102 <p>
103 You must declare the "privacy" permission in your extension's
104 <a href="manifest.html">manifest</a> to use the API. For example:
105 </p>
106 <pre>{
107 "name": "My extension",
108 ...
109 <b>"permissions": [
110 "privacy"
111 ]</b>,
112 ...
113 }</pre>
114 <h2 id="usage">Usage</h2>
115 <p>
116 Reading the current value of a Chrome setting is straightforward. You'll first
117 need to find the property you're interested in, then you'll call
118 <code>get()</code> on that object in order to retrieve its current value and
119 your extension's level of control. For example, to determine if Chrome's
120 Autofill feature is enabled, you'd write:
121 </p>
122 <pre>chrome.privacy.services.autofillEnabled.get({}, function(details) {
123 if (details.value)
124 console.log('Autofill is on!');
125 else
126 console.log('Autofill is off!');
127 });</pre>
128 <p>
129 Changing the value of a setting is a little bit more complex, simply because
130 you first must verify that your extension can control the setting. The user
131 won't see any change to her settings if you extension toggles a setting that
132 is either locked to a specific value by enterprise policies
133 (<code>levelOfControl</code> will be set to "not_controllable"), or if another
134 extension is controlling the value (<code>levelOfControl</code> will be set to
135 "controlled_by_other_extensions"). The <code>set()</code> call will succeed,
136 but the setting will be immediately overridden. As this might be confusing, it
137 is advisable to warn the user when the settings they've chosen aren't
138 practically applied.
139 </p>
140 <p class="note">
141 Full details about extensions' ability to control <code>ChromeSetting</code>s
142 can be found under
143 <a href="types.html#ChromeSetting">
144 <code>chrome.types.ChromeSetting</code></a>.
145 </p>
146 <p>
147 This means that you ought to use the <code>get()</code> method to determine
148 your level of access, and then only call <code>set()</code> if your extension
149 can grab control over the setting (in fact if your extension can't control the
150 setting it's probably a good idea to visibly disable the functionality to
151 reduce user confusion):
152 </p>
153 <pre>chrome.privacy.services.autofillEnabled.get({}, function(details) {
154 if (details.levelOfControl === 'controllable_by_this_extension') {
155 chrome.privacy.services.autofillEnabled.set({ value: true }, function() {
156 if (chrome.extension.lastError === undefined)
157 console.log("Hooray, it worked!");
158 else
159 console.log("Sadness!", chrome.extension.lastError);
160 }
161 }
162 });</pre>
163 <p>
164 If you're interested in changes to a setting's value, add a listener to its
165 <code>onChange</code> event. Among other uses, this will allow you to warn the
166 user if a more recently installed extension grabs control of a setting, or if
167 enterprise policy overrides your control. To listen for changes to Autofill's
168 status, for example, the following code would suffice:
169 </p>
170 <pre>chrome.privacy.services.autofillEnabled.onChange.addListener(
171 function (details) {
172 // The new value is stored in `details.value`, the new level of control
173 // in `details.levelOfControl`, and `details.incognitoSpecific` will be
174 // `true` if the value is specific to Incognito mode.
175 });</pre>
176 <h2 id="examples">Examples</h2>
177 <p>
178 For example code, see the
179 <a href="samples.html#privacy">Privacy API samples</a>.
180 </p>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698