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

Unified Diff: chrome/common/extensions/docs/privacy.html

Issue 9244005: Move the `privacy` extension API out of experimental. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: License. Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/docs/permission_warnings.html ('k') | chrome/common/extensions/docs/samples.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/docs/privacy.html
diff --git a/chrome/common/extensions/docs/experimental.privacy.html b/chrome/common/extensions/docs/privacy.html
similarity index 84%
copy from chrome/common/extensions/docs/experimental.privacy.html
copy to chrome/common/extensions/docs/privacy.html
index 3e99b2047cba735961c547297a1ed2bd88dfd98a..d3ddc8044dec9a5b6425ddaddf70174365e66ff8 100644
--- a/chrome/common/extensions/docs/experimental.privacy.html
+++ b/chrome/common/extensions/docs/privacy.html
@@ -16,7 +16,7 @@
<script type="text/javascript" src="js/api_page_generator.js"></script>
<script type="text/javascript" src="js/bootstrap.js"></script>
<script type="text/javascript" src="js/sidebar.js"></script>
- <meta name="description" content="Documentation for the chrome.experimental.privacy module, which is part of the Google Chrome extension APIs."><title>chrome.experimental.privacy - Google Chrome Extensions - Google Code</title></head>
+ <meta name="description" content="Documentation for the chrome.privacy module, which is part of the Google Chrome extension APIs."><title>Privacy - Google Chrome Extensions - Google Code</title></head>
<body> <div id="devModeWarning" class="displayModeWarning">
You are viewing extension docs in chrome via the 'file:' scheme: are you expecting to see local changes when you refresh? You'll need run chrome with --allow-file-access-from-files.
</div>
@@ -311,22 +311,57 @@
<div class="g-unit" id="gc-pagecontent">
<div id="pageTitle">
- <h1 class="page_title">chrome.experimental.privacy</h1>
+ <h1 class="page_title">Privacy</h1>
</div>
<!-- TABLE OF CONTENTS -->
<div id="toc">
<h2>Contents</h2>
<ol>
- <li style="display: none; ">
- <a>h2Name</a>
+ <li>
+ <a href="#manifest">Manifest</a>
<ol>
- <li>
+ <li style="display: none; ">
+ <a>h3Name</a>
+ </li>
+ </ol>
+ </li><li>
+ <a href="#usage">Usage</a>
+ <ol>
+ <li style="display: none; ">
+ <a>h3Name</a>
+ </li>
+ </ol>
+ </li><li>
+ <a href="#examples">Examples</a>
+ <ol>
+ <li style="display: none; ">
+ <a>h3Name</a>
+ </li>
+ </ol>
+ </li><li>
+ <a href="#manifest">Manifest</a>
+ <ol>
+ <li style="display: none; ">
+ <a>h3Name</a>
+ </li>
+ </ol>
+ </li><li>
+ <a href="#usage">Usage</a>
+ <ol>
+ <li style="display: none; ">
+ <a>h3Name</a>
+ </li>
+ </ol>
+ </li><li>
+ <a href="#examples">Examples</a>
+ <ol>
+ <li style="display: none; ">
<a>h3Name</a>
</li>
</ol>
</li>
<li>
- <a href="#apiReference">API reference: chrome.experimental.privacy</a>
+ <a href="#apiReference">API reference: chrome.privacy</a>
<ol>
<li>
<a href="#properties">Properties</a>
@@ -375,17 +410,230 @@
<!-- /TABLE OF CONTENTS -->
<!-- Standard content lead-in for experimental API pages -->
- <p id="classSummary">
+ <p id="classSummary" style="display: none; ">
For information on how to use experimental APIs, see the <a href="experimental.html">chrome.experimental.* APIs</a> page.
</p>
<!-- STATIC CONTENT PLACEHOLDER -->
- <div id="static"></div>
+ <div id="static"><div id="pageData-name" class="pageData">Privacy</div>
+
+<!-- BEGIN AUTHORED CONTENT -->
+<p id="classSummary">
+ Use the <code>chrome.privacy</code> module to control usage of the features in
+ Chrome that can affect a user's privacy. This module relies on the
+ <a href="types.html#ChromeSetting">ChromeSetting prototype of the type API</a>
+ for getting and setting Chrome's configuration.
+</p>
+
+<p class="note">
+ The <a href="http://www.google.com/intl/en/landing/chrome/google-chrome-privacy-whitepaper.pdf">Chrome Privacy Whitepaper</a>
+ gives background detail regarding the features which this API can control.
+</p>
+
+<h2 id="manifest">Manifest</h2>
+<p>
+ You must declare the "privacy" permission in your extension's
+ <a href="manifest.html">manifest</a> to use the API. For example:
+</p>
+
+<pre>{
+ "name": "My extension",
+ ...
+ <b>"permissions": [
+ "privacy"
+ ]</b>,
+ ...
+}</pre>
+
+<h2 id="usage">Usage</h2>
+
+<p>
+ Reading the current value of a Chrome setting is straightforward. You'll first
+ need to find the property you're interested in, then you'll call
+ <code>get()</code> on that object in order to retrieve it's current value and
+ your extension's level of control. For example, to determine if Chrome's
+ Autofill feature is enabled, you'd write:
+</p>
+
+<pre>chrome.privacy.services.autofillEnabled.get({}, function(details) {
+ if (details.value)
+ console.log('Autofill is on!');
+ else
+ console.log('Autofill is off!');
+});</pre>
+
+<p>
+ Changing the value of a setting is a little bit more complex, simply because
+ you first must verify that your extension can control the setting. The user
+ won't see any change to her settings if you extension toggles a setting that
+ is either locked to a specific value by enterprise policies
+ (<code>levelOfControl</code> will be set to "not_controllable"), or if another
+ extension is controlling the value (<code>levelOfControl</code> will be set to
+ "controlled_by_other_extensions"). The <code>set()</code> call will succeed,
+ but the setting will be immediately overridden. As this might be confusing, it
+ is advisable to warn the user when the settings they've chosen aren't
+ practically applied.
+</p>
+
+<p class="note">
+ Full details about extensions' ability to control <code>ChromeSetting</code>s
+ can be found under
+ <a href="types.html#ChromeSetting">
+ <code>chrome.types.ChromeSetting</code></a>.
+</p>
+
+<p>
+ This means that you ought to use the <code>get()</code> method to determine
+ your level of access, and then only call <code>set()</code> if your extension
+ can grab control over the setting (in fact if your extension can't control the
+ setting it's probably a good idea to visibly disable the functionality to
+ reduce user confusion):
+</p>
+
+<pre>chrome.privacy.services.autofillEnabled.get({}, function(details) {
+ if (details.levelOfControl === 'controllable_by_this_extension') {
+ chrome.privacy.services.autofillEnabled.set({ value: true }, function() {
+ if (chrome.extension.lastError === undefined)
+ console.log("Hooray, it worked!");
+ else
+ console.log("Sadness!", chrome.extension.lastError);
+ }
+ }
+});</pre>
+
+<p>
+ If you're interested in changes to a setting's value, add a listener to its
+ <code>onChange</code> event. Among other uses, this will allow you to warn the
+ user if a more recently installed extension grabs control of a setting, or if
+ enterprise policy overrides your control. To listen for changes to Autofill's
+ status, for example, the following code would suffice:
+</p>
+
+<pre>chrome.privacy.services.autofillEnabled.onChange.addListener(
+ function (details) {
+ // The new value is stored in `details.value`, the new level of control
+ // in `details.levelOfControl`, and `details.incognitoSpecific` will be
+ // `true` if the value is specific to Incognito mode.
+ });</pre>
+
+<h2 id="examples">Examples</h2>
+<p>
+ For example code, see the
+ <a href="samples.html#privacy">Privacy API samples</a>.
+</p>
+<!-- END AUTHORED CONTENT --><div id="pageData-name" class="pageData">Privacy</div>
+
+<!-- BEGIN AUTHORED CONTENT -->
+<p id="classSummary">
+ Use the <code>chrome.privacy</code> module to control usage of the features in
+ Chrome that can affect a user's privacy. This module relies on the
+ <a href="types.html#ChromeSetting">ChromeSetting prototype of the type API</a>
+ for getting and setting Chrome's configuration.
+</p>
+
+<p class="note">
+ The <a href="http://www.google.com/intl/en/landing/chrome/google-chrome-privacy-whitepaper.pdf">Chrome Privacy Whitepaper</a>
+ gives background detail regarding the features which this API can control.
+</p>
+
+<h2 id="manifest">Manifest</h2>
+<p>
+ You must declare the "privacy" permission in your extension's
+ <a href="manifest.html">manifest</a> to use the API. For example:
+</p>
+
+<pre>{
+ "name": "My extension",
+ ...
+ <b>"permissions": [
+ "privacy"
+ ]</b>,
+ ...
+}</pre>
+
+<h2 id="usage">Usage</h2>
+
+<p>
+ Reading the current value of a Chrome setting is straightforward. You'll first
+ need to find the property you're interested in, then you'll call
+ <code>get()</code> on that object in order to retrieve it's current value and
+ your extension's level of control. For example, to determine if Chrome's
+ Autofill feature is enabled, you'd write:
+</p>
+
+<pre>chrome.privacy.services.autofillEnabled.get({}, function(details) {
+ if (details.value)
+ console.log('Autofill is on!');
+ else
+ console.log('Autofill is off!');
+});</pre>
+
+<p>
+ Changing the value of a setting is a little bit more complex, simply because
+ you first must verify that your extension can control the setting. The user
+ won't see any change to her settings if you extension toggles a setting that
+ is either locked to a specific value by enterprise policies
+ (<code>levelOfControl</code> will be set to "not_controllable"), or if another
+ extension is controlling the value (<code>levelOfControl</code> will be set to
+ "controlled_by_other_extensions"). The <code>set()</code> call will succeed,
+ but the setting will be immediately overridden. As this might be confusing, it
+ is advisable to warn the user when the settings they've chosen aren't
+ practically applied.
+</p>
+
+<p class="note">
+ Full details about extensions' ability to control <code>ChromeSetting</code>s
+ can be found under
+ <a href="types.html#ChromeSetting">
+ <code>chrome.types.ChromeSetting</code></a>.
+</p>
+
+<p>
+ This means that you ought to use the <code>get()</code> method to determine
+ your level of access, and then only call <code>set()</code> if your extension
+ can grab control over the setting (in fact if your extension can't control the
+ setting it's probably a good idea to visibly disable the functionality to
+ reduce user confusion):
+</p>
+
+<pre>chrome.privacy.services.autofillEnabled.get({}, function(details) {
+ if (details.levelOfControl === 'controllable_by_this_extension') {
+ chrome.privacy.services.autofillEnabled.set({ value: true }, function() {
+ if (chrome.extension.lastError === undefined)
+ console.log("Hooray, it worked!");
+ else
+ console.log("Sadness!", chrome.extension.lastError);
+ }
+ }
+});</pre>
+
+<p>
+ If you're interested in changes to a setting's value, add a listener to its
+ <code>onChange</code> event. Among other uses, this will allow you to warn the
+ user if a more recently installed extension grabs control of a setting, or if
+ enterprise policy overrides your control. To listen for changes to Autofill's
+ status, for example, the following code would suffice:
+</p>
+
+<pre>chrome.privacy.services.autofillEnabled.onChange.addListener(
+ function (details) {
+ // The new value is stored in `details.value`, the new level of control
+ // in `details.levelOfControl`, and `details.incognitoSpecific` will be
+ // `true` if the value is specific to Incognito mode.
+ });</pre>
+
+<h2 id="examples">Examples</h2>
+<p>
+ For example code, see the
+ <a href="samples.html#privacy">Privacy API samples</a>.
+</p>
+<!-- END AUTHORED CONTENT -->
+</div>
<!-- API PAGE -->
<div class="apiPage">
<a name="apiReference"></a>
- <h2>API reference: chrome.experimental.privacy</h2>
+ <h2>API reference: chrome.privacy</h2>
<!-- PROPERTIES -->
<div class="apiGroup">
@@ -397,7 +645,7 @@
<h4>network</h4>
<div class="summary">
<!-- Note: intentionally longer 80 columns -->
- <span>chrome.experimental.privacy.</span><span>network</span>
+ <span>chrome.privacy.</span><span>network</span>
</div>
<div>
<dt>
@@ -536,7 +784,7 @@
<h4>services</h4>
<div class="summary">
<!-- Note: intentionally longer 80 columns -->
- <span>chrome.experimental.privacy.</span><span>services</span>
+ <span>chrome.privacy.</span><span>services</span>
</div>
<div>
<dt>
@@ -789,74 +1037,6 @@
</div><div>
<div>
<dt>
- <var>metricsReportingEnabled</var>
- <em>
-
- <!-- TYPE -->
- <div style="display:inline">
- (
- <span class="optional" style="display: none; ">optional</span>
- <span class="enum" style="display: none; ">enumerated</span>
- <span id="typeTemplate">
- <span>
- <a href="types.html#type-ChromeSetting">ChromeSetting</a>
- </span>
- <span style="display: none; ">
- <span>
- array of <span><span></span></span>
- </span>
- <span>paramType</span>
- <span></span>
- </span>
- </span>
- )
- </div>
-
- </em>
- </dt>
- <dd class="todo" style="display: none; ">
- Undocumented.
- </dd>
- <dd>If enabled, Chrome automatically sends usage statistics and crash reports to Google. This preference's value is a boolean, defaulting to <code>false</code>.</dd>
- <dd style="display: none; ">
- This parameter was added in version
- <b><span></span></b>.
- You must omit this parameter in earlier versions,
- and you may omit it in any version. If you require this
- parameter, the manifest key
- <a href="manifest.html#minimum_chrome_version">minimum_chrome_version</a>
- can ensure that your extension won't be run in an earlier browser version.
- </dd>
-
- <!-- OBJECT PROPERTIES -->
- <dd style="display: none; ">
- <dl>
- <div>
- <div>
- </div>
- </div>
- </dl>
- </dd>
-
- <!-- OBJECT METHODS -->
- <dd style="display: none; ">
- <div></div>
- </dd>
-
- <!-- OBJECT EVENT FIELDS -->
- <dd style="display: none; ">
- <div></div>
- </dd>
-
- <!-- FUNCTION PARAMETERS -->
- <dd style="display: none; ">
- <div></div>
- </dd>
-
- </div>
- </div><div>
- <div>
- <dt>
<var>safeBrowsingEnabled</var>
<em>
@@ -1083,7 +1263,7 @@
<h4>websites</h4>
<div class="summary">
<!-- Note: intentionally longer 80 columns -->
- <span>chrome.experimental.privacy.</span><span>websites</span>
+ <span>chrome.privacy.</span><span>websites</span>
</div>
<div>
<dt>
« no previous file with comments | « chrome/common/extensions/docs/permission_warnings.html ('k') | chrome/common/extensions/docs/samples.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698