| OLD | NEW |
| 1 <!-- BEGIN AUTHORED CONTENT --> | |
| 2 <p> | 1 <p> |
| 3 The content settings module allows you to change settings that control whether | 2 The content settings module allows you to change settings that control whether |
| 4 websites can use features such as cookies, JavaScript, and plug-ins. | 3 websites can use features such as cookies, JavaScript, and plug-ins. |
| 5 More generally speaking, content settings allow you to customize Chrome's | 4 More generally speaking, content settings allow you to customize Chrome's |
| 6 behavior on a per-site basis instead of globally.</p> | 5 behavior on a per-site basis instead of globally.</p> |
| 7 <p> | 6 <p> |
| 8 </p> | 7 </p> |
| 8 |
| 9 <h2 id="manifest">Manifest</h2> | 9 <h2 id="manifest">Manifest</h2> |
| 10 <p>You must declare the "contentSettings" permission | 10 <p>You must declare the "contentSettings" permission |
| 11 in your extension's manifest to use the API. | 11 in your extension's manifest to use the API. |
| 12 For example:</p> | 12 For example:</p> |
| 13 <pre>{ | 13 <pre>{ |
| 14 "name": "My extension", | 14 "name": "My extension", |
| 15 ... | 15 ... |
| 16 <b>"permissions": [ | 16 <b>"permissions": [ |
| 17 "contentSettings" | 17 "contentSettings" |
| 18 ]</b>, | 18 ]</b>, |
| 19 ... | 19 ... |
| 20 }</pre> | 20 }</pre> |
| 21 |
| 22 |
| 21 <h2 id="patterns">Content setting patterns</h2> | 23 <h2 id="patterns">Content setting patterns</h2> |
| 22 <p> | 24 <p> |
| 23 You can use patterns to specify the websites that each content setting affects. | 25 You can use patterns to specify the websites that each content setting affects. |
| 24 For example, <code>http://*.youtube.com/*</code> specifies youtube.com and all | 26 For example, <code>http://*.youtube.com/*</code> specifies youtube.com and all |
| 25 of its subdomains. The syntax for content setting patterns is the same as for | 27 of its subdomains. The syntax for content setting patterns is the same as for |
| 26 <a href="match_patterns.html">match patterns</a>, with a few differences: | 28 <a href="match_patterns.html">match patterns</a>, with a few differences: |
| 27 <ul><li>For <code>http</code>, | 29 <ul><li>For <code>http</code>, |
| 28 <code>https</code>, and <code>ftp</code> URLs, the path must be a wildcard | 30 <code>https</code>, and <code>ftp</code> URLs, the path must be a wildcard |
| 29 (<code>/*</code>). For <code>file</code> URLs, the path must be completely | 31 (<code>/*</code>). For <code>file</code> URLs, the path must be completely |
| 30 specified and <strong>must not</strong> contain wildcards.</li> | 32 specified and <strong>must not</strong> contain wildcards.</li> |
| 31 <li>In contrast to match patterns, content setting patterns can specify a port | 33 <li>In contrast to match patterns, content setting patterns can specify a port |
| 32 number. If a port number is specified, the pattern only matches websites with | 34 number. If a port number is specified, the pattern only matches websites with |
| 33 that port. If no port number is specified, the pattern matches all ports. | 35 that port. If no port number is specified, the pattern matches all ports. |
| 34 </li> | 36 </li> |
| 35 </ul> | 37 </ul> |
| 36 </p> | 38 </p> |
| 39 |
| 37 <h3 id="pattern-precedence">Pattern precedence</h3> | 40 <h3 id="pattern-precedence">Pattern precedence</h3> |
| 38 <p> | 41 <p> |
| 39 When more than one content setting rule applies for a given site, the rule with | 42 When more than one content setting rule applies for a given site, the rule with |
| 40 the more specific pattern takes precedence. | 43 the more specific pattern takes precedence. |
| 41 </p> | 44 </p> |
| 42 <p>For example, the following patterns are ordered by precedence:</p> | 45 <p>For example, the following patterns are ordered by precedence:</p> |
| 43 <ol> | 46 <ol> |
| 44 <li><code>http://www.example.com/*</code></li> | 47 <li><code>http://www.example.com/*</code></li> |
| 45 <li><code>http://*.example.com/*</code> (matching | 48 <li><code>http://*.example.com/*</code> (matching |
| 46 example.com and all subdomains)</li> | 49 example.com and all subdomains)</li> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 65 <ol> | 68 <ol> |
| 66 <li><code>http://www.example.com:*/*</code><br> | 69 <li><code>http://www.example.com:*/*</code><br> |
| 67 Specifies the hostname and scheme.</li> | 70 Specifies the hostname and scheme.</li> |
| 68 <li><code>*:/www.example.com:123/*</code><br> | 71 <li><code>*:/www.example.com:123/*</code><br> |
| 69 Not as high, because although it specifies the hostname, it doesn't specify | 72 Not as high, because although it specifies the hostname, it doesn't specify |
| 70 the scheme.</li> | 73 the scheme.</li> |
| 71 <li><code>http://*.example.com:123/*</code><br> | 74 <li><code>http://*.example.com:123/*</code><br> |
| 72 Lower because although it specifies the port and scheme, it has a wildcard | 75 Lower because although it specifies the port and scheme, it has a wildcard |
| 73 in the hostname.</li> | 76 in the hostname.</li> |
| 74 </ol> | 77 </ol> |
| 78 |
| 75 <h2 id="primary-secondary">Primary and secondary patterns</h2> | 79 <h2 id="primary-secondary">Primary and secondary patterns</h2> |
| 76 <p> | 80 <p> |
| 77 The URL taken into account when deciding which content setting to apply depends | 81 The URL taken into account when deciding which content setting to apply depends |
| 78 on the content type. For example, for | 82 on the content type. For example, for |
| 79 <a href="#property-notifications">notifications</a> settings are | 83 <a href="#property-notifications">notifications</a> settings are |
| 80 based on the URL shown in the omnibox. This URL is called the "primary" URL.</p> | 84 based on the URL shown in the omnibox. This URL is called the "primary" URL.</p> |
| 81 <p> | 85 <p> |
| 82 Some content types can take additional URLs into account. For example, | 86 Some content types can take additional URLs into account. For example, |
| 83 whether a site is allowed to set a | 87 whether a site is allowed to set a |
| 84 <a href="#property-cookies">cookie</a> is decided based on the URL | 88 <a href="#property-cookies">cookie</a> is decided based on the URL |
| (...skipping 19 matching lines...) Expand all Loading... |
| 104 </tr><tr> | 108 </tr><tr> |
| 105 <td>3</td> | 109 <td>3</td> |
| 106 <td><code><all_urls></code>, </td> | 110 <td><code><all_urls></code>, </td> |
| 107 <td><code>http://www.wombat.com/*</code></td> | 111 <td><code>http://www.wombat.com/*</code></td> |
| 108 </tr><tr> | 112 </tr><tr> |
| 109 <td>4</td> | 113 <td>4</td> |
| 110 <td><code><all_urls></code>, </td> | 114 <td><code><all_urls></code>, </td> |
| 111 <td><code><all_urls></code></td> | 115 <td><code><all_urls></code></td> |
| 112 </tr> | 116 </tr> |
| 113 </table> | 117 </table> |
| 118 |
| 114 <h2 id="resource-identifiers">Resource identifiers</h2> | 119 <h2 id="resource-identifiers">Resource identifiers</h2> |
| 115 <p> | 120 <p> |
| 116 Resource identifiers allow you to specify content settings for specific | 121 Resource identifiers allow you to specify content settings for specific |
| 117 subtypes of a content type. Currently, the only content type that supports | 122 subtypes of a content type. Currently, the only content type that supports |
| 118 resource identifiers is <a href="#property-plugins"><code>plugins</code></a>, | 123 resource identifiers is <a href="#property-plugins"><code>plugins</code></a>, |
| 119 where a resource identifier identifies a specific plug-in. When applying content | 124 where a resource identifier identifies a specific plug-in. When applying content |
| 120 settings, first the settings for the specific plug-in are checked. If there are | 125 settings, first the settings for the specific plug-in are checked. If there are |
| 121 no settings found for the specific plug-in, the general content settings for | 126 no settings found for the specific plug-in, the general content settings for |
| 122 plug-ins are checked. | 127 plug-ins are checked. |
| 123 </p> | 128 </p> |
| 124 <p> | 129 <p> |
| 125 For example, if a content setting rule has the resource identifier | 130 For example, if a content setting rule has the resource identifier |
| 126 <code>adobe-flash-player</code> and the pattern <code><all_urls></code>, | 131 <code>adobe-flash-player</code> and the pattern <code><all_urls></code>, |
| 127 it takes precedence over a rule without a resource identifier and the pattern | 132 it takes precedence over a rule without a resource identifier and the pattern |
| 128 <code>http://www.example.com/*</code>, even if that pattern is more specific. | 133 <code>http://www.example.com/*</code>, even if that pattern is more specific. |
| 129 </p> | 134 </p> |
| 130 <p> | 135 <p> |
| 131 You can get a list of resource identifiers for a content type by calling the | 136 You can get a list of resource identifiers for a content type by calling the |
| 132 <a href="contentSettings.html#method-ContentSetting-getResourceIdentifiers"> | 137 <a href="contentSettings.html#method-ContentSetting-getResourceIdentifiers"> |
| 133 <code>getResourceIdentifiers()</code></a> method. The returned list | 138 <code>getResourceIdentifiers()</code></a> method. The returned list |
| 134 can change with the set of installed plug-ins on the user's machine, but Chrome | 139 can change with the set of installed plug-ins on the user's machine, but Chrome |
| 135 tries to keep the identifiers stable across plug-in updates. | 140 tries to keep the identifiers stable across plug-in updates. |
| 136 </p> | 141 </p> |
| 142 |
| 137 <h2 id="examples">Examples</h2> | 143 <h2 id="examples">Examples</h2> |
| 144 |
| 138 <p> | 145 <p> |
| 139 You can find samples of this API on the | 146 You can find samples of this API on the |
| 140 <a href="samples.html#contentSettings">sample page</a>. | 147 <a href="samples.html#contentSettings">sample page</a>. |
| 141 </p> | 148 </p> |
| 142 <!-- END AUTHORED CONTENT --> | |
| OLD | NEW |