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

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: everything but svn stuff 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>
7
8 <p class="note"> 8 <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> 9 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. 10 gives background detail regarding the features which this API can control.
11 </p> 11 </p>
12
12 <h2 id="manifest">Manifest</h2> 13 <h2 id="manifest">Manifest</h2>
13 <p> 14 <p>
14 You must declare the "privacy" permission in your extension's 15 You must declare the "privacy" permission in your extension's
15 <a href="manifest.html">manifest</a> to use the API. For example: 16 <a href="manifest.html">manifest</a> to use the API. For example:
16 </p> 17 </p>
18
17 <pre>{ 19 <pre>{
18 "name": "My extension", 20 "name": "My extension",
19 ... 21 ...
20 <b>"permissions": [ 22 <b>"permissions": [
21 "privacy" 23 "privacy"
22 ]</b>, 24 ]</b>,
23 ... 25 ...
24 }</pre> 26 }</pre>
27
25 <h2 id="usage">Usage</h2> 28 <h2 id="usage">Usage</h2>
29
26 <p> 30 <p>
27 Reading the current value of a Chrome setting is straightforward. You'll first 31 Reading the current value of a Chrome setting is straightforward. You'll first
28 need to find the property you're interested in, then you'll call 32 need to find the property you're interested in, then you'll call
29 <code>get()</code> on that object in order to retrieve its current value and 33 <code>get()</code> on that object in order to retrieve its current value and
30 your extension's level of control. For example, to determine if Chrome's 34 your extension's level of control. For example, to determine if Chrome's
31 Autofill feature is enabled, you'd write: 35 Autofill feature is enabled, you'd write:
32 </p> 36 </p>
37
33 <pre>chrome.privacy.services.autofillEnabled.get({}, function(details) { 38 <pre>chrome.privacy.services.autofillEnabled.get({}, function(details) {
34 if (details.value) 39 if (details.value)
35 console.log('Autofill is on!'); 40 console.log('Autofill is on!');
36 else 41 else
37 console.log('Autofill is off!'); 42 console.log('Autofill is off!');
38 });</pre> 43 });</pre>
44
39 <p> 45 <p>
40 Changing the value of a setting is a little bit more complex, simply because 46 Changing the value of a setting is a little bit more complex, simply because
41 you first must verify that your extension can control the setting. The user 47 you first must verify that your extension can control the setting. The user
42 won't see any change to her settings if your extension toggles a setting that 48 won't see any change to her settings if your extension toggles a setting that
43 is either locked to a specific value by enterprise policies 49 is either locked to a specific value by enterprise policies
44 (<code>levelOfControl</code> will be set to "not_controllable"), or if another 50 (<code>levelOfControl</code> will be set to "not_controllable"), or if another
45 extension is controlling the value (<code>levelOfControl</code> will be set to 51 extension is controlling the value (<code>levelOfControl</code> will be set to
46 "controlled_by_other_extensions"). The <code>set()</code> call will succeed, 52 "controlled_by_other_extensions"). The <code>set()</code> call will succeed,
47 but the setting will be immediately overridden. As this might be confusing, it 53 but the setting will be immediately overridden. As this might be confusing, it
48 is advisable to warn the user when the settings they've chosen aren't 54 is advisable to warn the user when the settings they've chosen aren't
49 practically applied. 55 practically applied.
50 </p> 56 </p>
57
51 <p class="note"> 58 <p class="note">
52 Full details about extensions' ability to control <code>ChromeSetting</code>s 59 Full details about extensions' ability to control <code>ChromeSetting</code>s
53 can be found under 60 can be found under
54 <a href="types.html#ChromeSetting"> 61 <a href="types.html#ChromeSetting">
55 <code>chrome.types.ChromeSetting</code></a>. 62 <code>chrome.types.ChromeSetting</code></a>.
56 </p> 63 </p>
64
57 <p> 65 <p>
58 This means that you ought to use the <code>get()</code> method to determine 66 This means that you ought to use the <code>get()</code> method to determine
59 your level of access, and then only call <code>set()</code> if your extension 67 your level of access, and then only call <code>set()</code> if your extension
60 can grab control over the setting (in fact if your extension can't control the 68 can grab control over the setting (in fact if your extension can't control the
61 setting it's probably a good idea to visually disable the functionality to 69 setting it's probably a good idea to visually disable the functionality to
62 reduce user confusion): 70 reduce user confusion):
63 </p> 71 </p>
72
64 <pre>chrome.privacy.services.autofillEnabled.get({}, function(details) { 73 <pre>chrome.privacy.services.autofillEnabled.get({}, function(details) {
65 if (details.levelOfControl === 'controllable_by_this_extension') { 74 if (details.levelOfControl === 'controllable_by_this_extension') {
66 chrome.privacy.services.autofillEnabled.set({ value: true }, function() { 75 chrome.privacy.services.autofillEnabled.set({ value: true }, function() {
67 if (chrome.extension.lastError === undefined) 76 if (chrome.extension.lastError === undefined)
68 console.log("Hooray, it worked!"); 77 console.log("Hooray, it worked!");
69 else 78 else
70 console.log("Sadness!", chrome.extension.lastError); 79 console.log("Sadness!", chrome.extension.lastError);
71 } 80 }
72 } 81 }
73 });</pre> 82 });</pre>
83
74 <p> 84 <p>
75 If you're interested in changes to a setting's value, add a listener to its 85 If you're interested in changes to a setting's value, add a listener to its
76 <code>onChange</code> event. Among other uses, this will allow you to warn the 86 <code>onChange</code> event. Among other uses, this will allow you to warn the
77 user if a more recently installed extension grabs control of a setting, or if 87 user if a more recently installed extension grabs control of a setting, or if
78 enterprise policy overrides your control. To listen for changes to Autofill's 88 enterprise policy overrides your control. To listen for changes to Autofill's
79 status, for example, the following code would suffice: 89 status, for example, the following code would suffice:
80 </p> 90 </p>
91
81 <pre>chrome.privacy.services.autofillEnabled.onChange.addListener( 92 <pre>chrome.privacy.services.autofillEnabled.onChange.addListener(
82 function (details) { 93 function (details) {
83 // The new value is stored in `details.value`, the new level of control 94 // The new value is stored in `details.value`, the new level of control
84 // in `details.levelOfControl`, and `details.incognitoSpecific` will be 95 // in `details.levelOfControl`, and `details.incognitoSpecific` will be
85 // `true` if the value is specific to Incognito mode. 96 // `true` if the value is specific to Incognito mode.
86 });</pre> 97 });</pre>
98
87 <h2 id="examples">Examples</h2> 99 <h2 id="examples">Examples</h2>
88 <p> 100 <p>
89 For example code, see the 101 For example code, see the
90 <a href="samples.html#privacy">Privacy API samples</a>. 102 <a href="samples.html#privacy">Privacy API samples</a>.
91 </p> 103 </p>
104
105
106
107 <p id="classSummary">
108 Use the <code>chrome.privacy</code> module to control usage of the features in
109 Chrome that can affect a user's privacy. This module relies on the
110 <a href="types.html#ChromeSetting">ChromeSetting prototype of the type API</a>
111 for getting and setting Chrome's configuration.
112 </p>
113
114 <p class="note">
115 The <a href="http://www.google.com/intl/en/landing/chrome/google-chrome-privac y-whitepaper.pdf">Chrome Privacy Whitepaper</a>
116 gives background detail regarding the features which this API can control.
117 </p>
118
119 <h2 id="manifest">Manifest</h2>
120 <p>
121 You must declare the "privacy" permission in your extension's
122 <a href="manifest.html">manifest</a> to use the API. For example:
123 </p>
124
125 <pre>{
126 "name": "My extension",
127 ...
128 <b>"permissions": [
129 "privacy"
130 ]</b>,
131 ...
132 }</pre>
133
134 <h2 id="usage">Usage</h2>
135
136 <p>
137 Reading the current value of a Chrome setting is straightforward. You'll first
138 need to find the property you're interested in, then you'll call
139 <code>get()</code> on that object in order to retrieve its current value and
140 your extension's level of control. For example, to determine if Chrome's
141 Autofill feature is enabled, you'd write:
142 </p>
143
144 <pre>chrome.privacy.services.autofillEnabled.get({}, function(details) {
145 if (details.value)
146 console.log('Autofill is on!');
147 else
148 console.log('Autofill is off!');
149 });</pre>
150
151 <p>
152 Changing the value of a setting is a little bit more complex, simply because
153 you first must verify that your extension can control the setting. The user
154 won't see any change to her settings if you extension toggles a setting that
155 is either locked to a specific value by enterprise policies
156 (<code>levelOfControl</code> will be set to "not_controllable"), or if another
157 extension is controlling the value (<code>levelOfControl</code> will be set to
158 "controlled_by_other_extensions"). The <code>set()</code> call will succeed,
159 but the setting will be immediately overridden. As this might be confusing, it
160 is advisable to warn the user when the settings they've chosen aren't
161 practically applied.
162 </p>
163
164 <p class="note">
165 Full details about extensions' ability to control <code>ChromeSetting</code>s
166 can be found under
167 <a href="types.html#ChromeSetting">
168 <code>chrome.types.ChromeSetting</code></a>.
169 </p>
170
171 <p>
172 This means that you ought to use the <code>get()</code> method to determine
173 your level of access, and then only call <code>set()</code> if your extension
174 can grab control over the setting (in fact if your extension can't control the
175 setting it's probably a good idea to visibly disable the functionality to
176 reduce user confusion):
177 </p>
178
179 <pre>chrome.privacy.services.autofillEnabled.get({}, function(details) {
180 if (details.levelOfControl === 'controllable_by_this_extension') {
181 chrome.privacy.services.autofillEnabled.set({ value: true }, function() {
182 if (chrome.extension.lastError === undefined)
183 console.log("Hooray, it worked!");
184 else
185 console.log("Sadness!", chrome.extension.lastError);
186 }
187 }
188 });</pre>
189
190 <p>
191 If you're interested in changes to a setting's value, add a listener to its
192 <code>onChange</code> event. Among other uses, this will allow you to warn the
193 user if a more recently installed extension grabs control of a setting, or if
194 enterprise policy overrides your control. To listen for changes to Autofill's
195 status, for example, the following code would suffice:
196 </p>
197
198 <pre>chrome.privacy.services.autofillEnabled.onChange.addListener(
199 function (details) {
200 // The new value is stored in `details.value`, the new level of control
201 // in `details.levelOfControl`, and `details.incognitoSpecific` will be
202 // `true` if the value is specific to Incognito mode.
203 });</pre>
204
205 <h2 id="examples">Examples</h2>
206 <p>
207 For example code, see the
208 <a href="samples.html#privacy">Privacy API samples</a>.
209 </p>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698