| Index: chrome/common/extensions/docs/static/contentSettings.html
|
| diff --git a/chrome/common/extensions/docs/static/contentSettings.html b/chrome/common/extensions/docs/static/contentSettings.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..8ce8b8e18949f358054912b1c6576abd737170a7
|
| --- /dev/null
|
| +++ b/chrome/common/extensions/docs/static/contentSettings.html
|
| @@ -0,0 +1,153 @@
|
| +<div id="pageData-name" class="pageData">Content Settings</div>
|
| +
|
| +<!-- BEGIN AUTHORED CONTENT -->
|
| +<p>
|
| +The content settings module allows you to change settings that control whether
|
| +websites can use features such as cookies, JavaScript, and plug-ins.
|
| +More generally speaking, content settings allow you to customize Chrome's
|
| +behavior on a per-site basis instead of globally.</p>
|
| +<p>
|
| +</p>
|
| +
|
| +<h2 id="manifest">Manifest</h2>
|
| +<p>You must declare the "contentSettings" permission
|
| +in your extension's manifest to use the API.
|
| +For example:</p>
|
| +<pre>{
|
| + "name": "My extension",
|
| + ...
|
| + <b>"permissions": [
|
| + "contentSettings"
|
| + ]</b>,
|
| + ...
|
| +}</pre>
|
| +
|
| +
|
| +<h2 id="patterns">Content setting patterns</h2>
|
| +<p>
|
| +You can use patterns to specify the websites that each content setting affects.
|
| +For example, <code>http://*.youtube.com/*</code> specifies youtube.com and all
|
| +of its subdomains. The syntax for content setting patterns is the same as for
|
| +<a href="match_patterns.html">match patterns</a>, with a few differences:
|
| +<ul><li>For <code>http</code>,
|
| +<code>https</code>, and <code>ftp</code> URLs, the path must be a wildcard
|
| +(<code>/*</code>). For <code>file</code> URLs, the path must be completely
|
| +specified and <strong>must not</strong> contain wildcards.</li>
|
| +<li>In contrast to match patterns, content setting patterns can specify a port
|
| +number. If a port number is specified, the pattern only matches websites with
|
| +that port. If no port number is specified, the pattern matches all ports.
|
| +</li>
|
| +</ul>
|
| +</p>
|
| +
|
| +<h3 id="pattern-precedence">Pattern precedence</h3>
|
| +<p>
|
| +When more than one content setting rule applies for a given site, the rule with
|
| +the more specific pattern takes precedence.
|
| +</p>
|
| +<p>For example, the following patterns are ordered by precedence:</p>
|
| +<ol>
|
| +<li><code>http://www.example.com/*</code></li>
|
| +<li><code>http://*.example.com/*</code> (matching
|
| +example.com and all subdomains)</li>
|
| +<li><code><all_urls></code> (matching every URL)</li>
|
| +</ol>
|
| +<p>
|
| +Three kinds of wildcards affect how specific a pattern is:
|
| +</p>
|
| +<ul>
|
| +<li>Wildcards in the port (for example
|
| +<code>http://www.example.com:*/*</code>)</li>
|
| +<li>Wildcards in the scheme (for example
|
| +<code>*://www.example.com:123/*</code>)</li>
|
| +<li>Wildcards in the hostname (for example
|
| +<code>http://*.example.com:123/*</code>)</li>
|
| +</ul>
|
| +<p>
|
| +If a pattern is more specific than another pattern in one part but less specific
|
| +in another part, the different parts are checked in the following order:
|
| +hostname, scheme, port. For example, the following patterns are ordered by
|
| +precedence:</p>
|
| +<ol>
|
| +<li><code>http://www.example.com:*/*</code><br>
|
| +Specifies the hostname and scheme.</li>
|
| +<li><code>*:/www.example.com:123/*</code><br>
|
| +Not as high, because although it specifies the hostname, it doesn't specify
|
| +the scheme.</li>
|
| +<li><code>http://*.example.com:123/*</code><br>
|
| +Lower because although it specifies the port and scheme, it has a wildcard
|
| +in the hostname.</li>
|
| +</ol>
|
| +
|
| +<h2 id="primary-secondary">Primary and secondary patterns</h2>
|
| +<p>
|
| +The URL taken into account when deciding which content setting to apply depends
|
| +on the content type. For example, for
|
| +<a href="#property-notifications">notifications</a> settings are
|
| +based on the URL shown in the omnibox. This URL is called the "primary" URL.</p>
|
| +<p>
|
| +Some content types can take additional URLs into account. For example,
|
| +whether a site is allowed to set a
|
| +<a href="#property-cookies">cookie</a> is decided based on the URL
|
| +of the HTTP request (which is the primary URL in this case) as well as the URL
|
| +shown in the omnibox (which is called the "secondary" URL).
|
| +</p>
|
| +<p>
|
| +If multiple rules have primary and secondary patterns, the rule with the more
|
| +specific primary pattern takes precedence. If there multiple rules have the same
|
| +primary pattern, the rule with the more specific secondary pattern takes
|
| +precedence. For example, the following list of primary/secondary pattern pairs
|
| +is ordered by precedence:</p>
|
| +<table>
|
| +<tr><th>Precedence</th><th>Primary pattern</th><th>Secondary pattern</th>
|
| +<tr>
|
| + <td>1</td>
|
| + <td><code>http://www.moose.com/*</code>, </td>
|
| + <td><code>http://www.wombat.com/*</code></td>
|
| +</tr><tr>
|
| + <td>2</td>
|
| + <td><code>http://www.moose.com/*</code>, </td>
|
| + <td><code><all_urls></code></td>
|
| +</tr><tr>
|
| + <td>3</td>
|
| + <td><code><all_urls></code>, </td>
|
| + <td><code>http://www.wombat.com/*</code></td>
|
| +</tr><tr>
|
| + <td>4</td>
|
| + <td><code><all_urls></code>, </td>
|
| + <td><code><all_urls></code></td>
|
| +</tr>
|
| +</table>
|
| +
|
| +<h2 id="resource-identifiers">Resource identifiers</h2>
|
| +<p>
|
| +Resource identifiers allow you to specify content settings for specific
|
| +subtypes of a content type. Currently, the only content type that supports
|
| +resource identifiers is <a href="#property-plugins"><code>plugins</code></a>,
|
| +where a resource identifier identifies a specific plug-in. When applying content
|
| +settings, first the settings for the specific plug-in are checked. If there are
|
| +no settings found for the specific plug-in, the general content settings for
|
| +plug-ins are checked.
|
| +</p>
|
| +<p>
|
| +For example, if a content setting rule has the resource identifier
|
| +<code>adobe-flash-player</code> and the pattern <code><all_urls></code>,
|
| +it takes precedence over a rule without a resource identifier and the pattern
|
| +<code>http://www.example.com/*</code>, even if that pattern is more specific.
|
| +</p>
|
| +<p>
|
| +You can get a list of resource identifiers for a content type by calling the
|
| +<a href="contentSettings.html#method-ContentSetting-getResourceIdentifiers">
|
| +<code>getResourceIdentifiers()</code></a> method. The returned list
|
| +can change with the set of installed plug-ins on the user's machine, but Chrome
|
| +tries to keep the identifiers stable across plug-in updates.
|
| +</p>
|
| +
|
| +<h2 id="examples">Examples</h2>
|
| +
|
| +<p>
|
| +You can find samples of this API on the
|
| +<a href="samples.html#contentSettings">sample page</a>.
|
| +</p>
|
| +
|
| +<!-- END AUTHORED CONTENT -->
|
|
|