| OLD | NEW |
| 1 <div id="pageData-name" class="pageData">Proxy Settings</div> | 1 <div id="pageData-name" class="pageData">Proxy Settings</div> |
| 2 | 2 |
| 3 <!-- BEGIN AUTHORED CONTENT --> | 3 <!-- BEGIN AUTHORED CONTENT --> |
| 4 <p id="classSummary"> | 4 <p id="classSummary"> |
| 5 Use the <code>chrome.proxy</code> module to manage Chrome's | 5 Use the <code>chrome.proxy</code> module to manage Chrome's |
| 6 proxy settings. This module relies on the <a href="preferences.html">preferences | 6 proxy settings. This module relies on the <a href="preferences.html">preferences |
| 7 API</a> for getting and setting the proxy configuration. | 7 API</a> for getting and setting the proxy configuration. |
| 8 </p> | 8 </p> |
| 9 | 9 |
| 10 <h2 id="manifest">Manifest</h2> | 10 <h2 id="manifest">Manifest</h2> |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 }, | 170 }, |
| 171 bypassList: ["foobar.com"] | 171 bypassList: ["foobar.com"] |
| 172 } | 172 } |
| 173 }; | 173 }; |
| 174 chrome.proxy.settings.set( | 174 chrome.proxy.settings.set( |
| 175 {value: config, scope: 'regular'}, | 175 {value: config, scope: 'regular'}, |
| 176 function() {}); | 176 function() {}); |
| 177 </pre> | 177 </pre> |
| 178 | 178 |
| 179 <p> | 179 <p> |
| 180 The following code sets a custom PAC script. | 180 The following code sets a custom pac script. |
| 181 </p> | 181 </p> |
| 182 | 182 |
| 183 <pre> | 183 <pre> |
| 184 var config = { | 184 var config = { |
| 185 mode: "pac_script", | 185 mode: "pac_script", |
| 186 pacScript: { | 186 pacScript: { |
| 187 data: "function FindProxyForURL(url, host) {\n" + | 187 data: "function FindProxyForURL(url, host) {\n" + |
| 188 " if (host == 'foobar.com')\n" + | 188 " if (host == 'foobar.com')\n" + |
| 189 " return 'PROXY blackhole:80';\n" + | 189 " return 'PROXY blackhole:80';\n" + |
| 190 " return 'DIRECT';\n" + | 190 " return 'DIRECT';\n" + |
| 191 "}" | 191 "}" |
| 192 } | 192 } |
| 193 }; | 193 }; |
| 194 chrome.proxy.settings.set( | 194 chrome.proxy.settings.set( |
| 195 {value: config, scope: 'regular'}, | 195 {value: config, scope: 'regular'}, |
| 196 function() {}); | 196 function() {}); |
| 197 </pre> | 197 </pre> |
| 198 | 198 |
| 199 <p> | 199 <p> |
| 200 The next snippet queries the currently effective proxy settings. The effective | 200 The next snippet queries the currently effective proxy settings. The effective |
| 201 proxy settings can be determined by another extension or by a policy. See the <a | 201 proxy settings can be determined by another extension or by a policy, see the <a |
| 202 href="preferences.html">Preferences API</a> documentation for details. | 202 href="preferences.html">Preferences API</a> documentation. |
| 203 </p> | 203 </p> |
| 204 | 204 |
| 205 <pre> | 205 <pre> |
| 206 chrome.proxy.settings.getEffective( | 206 chrome.proxy.settings.getEffective( |
| 207 {'incognito': false}, | 207 {'incognito': false}, |
| 208 function(config) {console.log(JSON.stringify(config));}); | 208 function(config) {console.log(JSON.stringify(config));}); |
| 209 </pre> | 209 </pre> |
| 210 | 210 |
| 211 <p> | 211 <p> |
| 212 Note that the <code>value</code> object passed to <code>set()</code> is not | 212 Note that the <code>value</code> object passed to <code>set()</code> is not |
| 213 identical to the <code>value</code> object passed to callback function of | 213 identical to the <code>value</code> object passed to callback function of |
| 214 <code>getEffective()</code>. The latter will contain a | 214 <code>getEffective()</code>. The latter will contain a |
| 215 <code>rules.httpProxy.port</code> element. | 215 <code>rules.httpProxy.port</code> element. |
| 216 </p> | 216 </p> |
| 217 | 217 |
| 218 <!-- END AUTHORED CONTENT --> | 218 <!-- END AUTHORED CONTENT --> |
| OLD | NEW |