| OLD | NEW |
| 1 <h2 id="manifest">Manifest</h2> | 1 <h2 id="manifest">Manifest</h2> |
| 2 <p>You must declare the "proxy" permission | 2 <p>You must declare the "proxy" permission |
| 3 in the <a href="manifest.html">extension manifest</a> | 3 in the <a href="manifest">extension manifest</a> |
| 4 to use the proxy settings API. | 4 to use the proxy settings API. |
| 5 For example:</p> | 5 For example:</p> |
| 6 <pre data-filename="manifest.json"> | 6 <pre data-filename="manifest.json"> |
| 7 { | 7 { |
| 8 "name": "My extension", | 8 "name": "My extension", |
| 9 ... | 9 ... |
| 10 <b>"permissions": [ | 10 <b>"permissions": [ |
| 11 "proxy" | 11 "proxy" |
| 12 ]</b>, | 12 ]</b>, |
| 13 ... | 13 ... |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 </dl> | 168 </dl> |
| 169 | 169 |
| 170 | 170 |
| 171 <h2 id="overview-examples">Examples</h2> | 171 <h2 id="overview-examples">Examples</h2> |
| 172 | 172 |
| 173 <p> | 173 <p> |
| 174 The following code sets a SOCKS 5 proxy for HTTP connections to all servers but | 174 The following code sets a SOCKS 5 proxy for HTTP connections to all servers but |
| 175 foobar.com and uses direct connections for all other protocols. The settings | 175 foobar.com and uses direct connections for all other protocols. The settings |
| 176 apply to regular and incognito windows, as incognito windows inherit settings | 176 apply to regular and incognito windows, as incognito windows inherit settings |
| 177 from regular windows. Please also consult the <a | 177 from regular windows. Please also consult the <a |
| 178 href="types.html#ChromeSetting">Types API</a> documentation. | 178 href="types#ChromeSetting">Types API</a> documentation. |
| 179 </p> | 179 </p> |
| 180 | 180 |
| 181 <pre> | 181 <pre> |
| 182 var config = { | 182 var config = { |
| 183 mode: "fixed_servers", | 183 mode: "fixed_servers", |
| 184 rules: { | 184 rules: { |
| 185 proxyForHttp: { | 185 proxyForHttp: { |
| 186 scheme: "socks5", | 186 scheme: "socks5", |
| 187 host: "1.2.3.4" | 187 host: "1.2.3.4" |
| 188 }, | 188 }, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 210 } | 210 } |
| 211 }; | 211 }; |
| 212 chrome.proxy.settings.set( | 212 chrome.proxy.settings.set( |
| 213 {value: config, scope: 'regular'}, | 213 {value: config, scope: 'regular'}, |
| 214 function() {}); | 214 function() {}); |
| 215 </pre> | 215 </pre> |
| 216 | 216 |
| 217 <p> | 217 <p> |
| 218 The next snippet queries the currently effective proxy settings. The effective | 218 The next snippet queries the currently effective proxy settings. The effective |
| 219 proxy settings can be determined by another extension or by a policy. See the <a | 219 proxy settings can be determined by another extension or by a policy. See the <a |
| 220 href="types.html#ChromeSetting">Types API</a> documentation for details. | 220 href="types#ChromeSetting">Types API</a> documentation for details. |
| 221 </p> | 221 </p> |
| 222 | 222 |
| 223 <pre> | 223 <pre> |
| 224 chrome.proxy.settings.get( | 224 chrome.proxy.settings.get( |
| 225 {'incognito': false}, | 225 {'incognito': false}, |
| 226 function(config) {console.log(JSON.stringify(config));}); | 226 function(config) {console.log(JSON.stringify(config));}); |
| 227 </pre> | 227 </pre> |
| 228 | 228 |
| 229 <p> | 229 <p> |
| 230 Note that the <code>value</code> object passed to <code>set()</code> is not | 230 Note that the <code>value</code> object passed to <code>set()</code> is not |
| 231 identical to the <code>value</code> object passed to callback function of | 231 identical to the <code>value</code> object passed to callback function of |
| 232 <code>get()</code>. The latter will contain a | 232 <code>get()</code>. The latter will contain a |
| 233 <code>rules.proxyForHttp.port</code> element. | 233 <code>rules.proxyForHttp.port</code> element. |
| 234 </p> | 234 </p> |
| OLD | NEW |