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