| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/net/chrome_url_request_context.h" | 5 #include "chrome/browser/net/chrome_url_request_context.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "net/http/http_util.h" | 23 #include "net/http/http_util.h" |
| 24 #include "net/proxy/proxy_service.h" | 24 #include "net/proxy/proxy_service.h" |
| 25 #include "webkit/glue/webkit_glue.h" | 25 #include "webkit/glue/webkit_glue.h" |
| 26 | 26 |
| 27 net::ProxyConfig* CreateProxyConfig(const CommandLine& command_line) { | 27 net::ProxyConfig* CreateProxyConfig(const CommandLine& command_line) { |
| 28 // Scan for all "enable" type proxy switches. | 28 // Scan for all "enable" type proxy switches. |
| 29 static const wchar_t* proxy_switches[] = { | 29 static const wchar_t* proxy_switches[] = { |
| 30 switches::kProxyServer, | 30 switches::kProxyServer, |
| 31 switches::kProxyPacUrl, | 31 switches::kProxyPacUrl, |
| 32 switches::kProxyAutoDetect, | 32 switches::kProxyAutoDetect, |
| 33 switches::kProxyBypassUrls | 33 switches::kProxyBypassList |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 bool found_enable_proxy_switch = false; | 36 bool found_enable_proxy_switch = false; |
| 37 for (size_t i = 0; i < arraysize(proxy_switches); i++) { | 37 for (size_t i = 0; i < arraysize(proxy_switches); i++) { |
| 38 if (command_line.HasSwitch(proxy_switches[i])) { | 38 if (command_line.HasSwitch(proxy_switches[i])) { |
| 39 found_enable_proxy_switch = true; | 39 found_enable_proxy_switch = true; |
| 40 break; | 40 break; |
| 41 } | 41 } |
| 42 } | 42 } |
| 43 | 43 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 66 if (command_line.HasSwitch(switches::kProxyPacUrl)) { | 66 if (command_line.HasSwitch(switches::kProxyPacUrl)) { |
| 67 proxy_config->pac_url = | 67 proxy_config->pac_url = |
| 68 GURL(WideToASCII(command_line.GetSwitchValue( | 68 GURL(WideToASCII(command_line.GetSwitchValue( |
| 69 switches::kProxyPacUrl))); | 69 switches::kProxyPacUrl))); |
| 70 } | 70 } |
| 71 | 71 |
| 72 if (command_line.HasSwitch(switches::kProxyAutoDetect)) { | 72 if (command_line.HasSwitch(switches::kProxyAutoDetect)) { |
| 73 proxy_config->auto_detect = true; | 73 proxy_config->auto_detect = true; |
| 74 } | 74 } |
| 75 | 75 |
| 76 if (command_line.HasSwitch(switches::kProxyBypassUrls)) { | 76 if (command_line.HasSwitch(switches::kProxyBypassList)) { |
| 77 proxy_config->ParseNoProxyList( | 77 proxy_config->ParseNoProxyList( |
| 78 WideToASCII(command_line.GetSwitchValue( | 78 WideToASCII(command_line.GetSwitchValue( |
| 79 switches::kProxyBypassUrls))); | 79 switches::kProxyBypassList))); |
| 80 } | 80 } |
| 81 | 81 |
| 82 return proxy_config; | 82 return proxy_config; |
| 83 } | 83 } |
| 84 | 84 |
| 85 // Create a proxy service according to the options on command line. | 85 // Create a proxy service according to the options on command line. |
| 86 static net::ProxyService* CreateProxyService(URLRequestContext* context, | 86 static net::ProxyService* CreateProxyService(URLRequestContext* context, |
| 87 const CommandLine& command_line) { | 87 const CommandLine& command_line) { |
| 88 scoped_ptr<net::ProxyConfig> proxy_config(CreateProxyConfig(command_line)); | 88 scoped_ptr<net::ProxyConfig> proxy_config(CreateProxyConfig(command_line)); |
| 89 | 89 |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 // Do not delete the cookie store in the case of the media context, as it is | 426 // Do not delete the cookie store in the case of the media context, as it is |
| 427 // owned by the original context. | 427 // owned by the original context. |
| 428 if (!is_media_) | 428 if (!is_media_) |
| 429 delete cookie_store_; | 429 delete cookie_store_; |
| 430 | 430 |
| 431 // Do not delete the proxy service in the case of OTR or media contexts, as | 431 // Do not delete the proxy service in the case of OTR or media contexts, as |
| 432 // it is owned by the original URLRequestContext. | 432 // it is owned by the original URLRequestContext. |
| 433 if (!is_off_the_record_ && !is_media_) | 433 if (!is_off_the_record_ && !is_media_) |
| 434 delete proxy_service_; | 434 delete proxy_service_; |
| 435 } | 435 } |
| OLD | NEW |