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

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

Issue 282073004: Minor correction on example code for privavy extension documentation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <p class="note"> 1 <p class="note">
2 The <a href="http://www.google.com/intl/en/landing/chrome/google-chrome-privac y-whitepaper.pdf">Chrome Privacy Whitepaper</a> 2 The <a href="http://www.google.com/intl/en/landing/chrome/google-chrome-privac y-whitepaper.pdf">Chrome Privacy Whitepaper</a>
3 gives background detail regarding the features which this API can control. 3 gives background detail regarding the features which this API can control.
4 </p> 4 </p>
5 5
6 <h2 id="manifest">Manifest</h2> 6 <h2 id="manifest">Manifest</h2>
7 <p> 7 <p>
8 You must declare the "privacy" permission in your extension's 8 You must declare the "privacy" permission in your extension's
9 <a href="manifest.html">manifest</a> to use the API. For example: 9 <a href="manifest.html">manifest</a> to use the API. For example:
10 </p> 10 </p>
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 reduce user confusion): 65 reduce user confusion):
66 </p> 66 </p>
67 67
68 <pre>chrome.privacy.services.autofillEnabled.get({}, function(details) { 68 <pre>chrome.privacy.services.autofillEnabled.get({}, function(details) {
69 if (details.levelOfControl === 'controllable_by_this_extension') { 69 if (details.levelOfControl === 'controllable_by_this_extension') {
70 chrome.privacy.services.autofillEnabled.set({ value: true }, function() { 70 chrome.privacy.services.autofillEnabled.set({ value: true }, function() {
71 if (chrome.runtime.lastError === undefined) 71 if (chrome.runtime.lastError === undefined)
72 console.log("Hooray, it worked!"); 72 console.log("Hooray, it worked!");
73 else 73 else
74 console.log("Sadness!", chrome.runtime.lastError); 74 console.log("Sadness!", chrome.runtime.lastError);
75 } 75 });
76 } 76 }
77 });</pre> 77 });</pre>
78 78
79 <p> 79 <p>
80 If you're interested in changes to a setting's value, add a listener to its 80 If you're interested in changes to a setting's value, add a listener to its
81 <code>onChange</code> event. Among other uses, this will allow you to warn the 81 <code>onChange</code> event. Among other uses, this will allow you to warn the
82 user if a more recently installed extension grabs control of a setting, or if 82 user if a more recently installed extension grabs control of a setting, or if
83 enterprise policy overrides your control. To listen for changes to Autofill's 83 enterprise policy overrides your control. To listen for changes to Autofill's
84 status, for example, the following code would suffice: 84 status, for example, the following code would suffice:
85 </p> 85 </p>
86 86
87 <pre>chrome.privacy.services.autofillEnabled.onChange.addListener( 87 <pre>chrome.privacy.services.autofillEnabled.onChange.addListener(
88 function (details) { 88 function (details) {
89 // The new value is stored in `details.value`, the new level of control 89 // The new value is stored in `details.value`, the new level of control
90 // in `details.levelOfControl`, and `details.incognitoSpecific` will be 90 // in `details.levelOfControl`, and `details.incognitoSpecific` will be
91 // `true` if the value is specific to Incognito mode. 91 // `true` if the value is specific to Incognito mode.
92 });</pre> 92 });</pre>
93 93
94 <h2 id="examples">Examples</h2> 94 <h2 id="examples">Examples</h2>
95 <p> 95 <p>
96 For example code, see the 96 For example code, see the
97 <a href="samples.html#privacy">Privacy API samples</a>. 97 <a href="samples.html#privacy">Privacy API samples</a>.
98 </p> 98 </p>
99 99
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698