Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(526)

Side by Side Diff: chrome/browser/net/chrome_url_request_context.cc

Issue 113465: Shorten the new proxy switch names. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "chrome/browser/extensions/extension.h" 11 #include "chrome/browser/extensions/extension.h"
12 #include "chrome/browser/extensions/extensions_service.h" 12 #include "chrome/browser/extensions/extensions_service.h"
13 #include "chrome/browser/extensions/user_script_master.h" 13 #include "chrome/browser/extensions/user_script_master.h"
14 #include "chrome/browser/profile.h" 14 #include "chrome/browser/profile.h"
15 #include "chrome/common/chrome_constants.h" 15 #include "chrome/common/chrome_constants.h"
16 #include "chrome/common/chrome_switches.h" 16 #include "chrome/common/chrome_switches.h"
17 #include "chrome/common/notification_service.h" 17 #include "chrome/common/notification_service.h"
18 #include "chrome/common/pref_names.h" 18 #include "chrome/common/pref_names.h"
19 #include "net/ftp/ftp_network_layer.h" 19 #include "net/ftp/ftp_network_layer.h"
20 #include "net/http/http_cache.h" 20 #include "net/http/http_cache.h"
21 #include "net/http/http_network_layer.h" 21 #include "net/http/http_network_layer.h"
22 #include "net/http/http_util.h" 22 #include "net/http/http_util.h"
23 #include "net/proxy/proxy_service.h" 23 #include "net/proxy/proxy_service.h"
24 #include "webkit/glue/webkit_glue.h" 24 #include "webkit/glue/webkit_glue.h"
25 25
26 net::ProxyConfig* CreateProxyConfig(const CommandLine& command_line) { 26 net::ProxyConfig* CreateProxyConfig(const CommandLine& command_line) {
27 // Scan for all "enable" type proxy switches. 27 // Scan for all "enable" type proxy switches.
28 static const wchar_t* proxy_switches[] = { 28 static const wchar_t* proxy_switches[] = {
29 switches::kProxyServer, 29 switches::kProxyServer,
30 switches::kProxyServerPacUrl, 30 switches::kProxyPacUrl,
31 switches::kProxyServerAutoDetect, 31 switches::kProxyAutoDetect,
32 switches::kProxyServerBypassUrls 32 switches::kProxyBypassUrls
33 }; 33 };
34 34
35 bool found_enable_proxy_switch = false; 35 bool found_enable_proxy_switch = false;
36 for (size_t i = 0; i < arraysize(proxy_switches); i++) { 36 for (size_t i = 0; i < arraysize(proxy_switches); i++) {
37 if (command_line.HasSwitch(proxy_switches[i])) { 37 if (command_line.HasSwitch(proxy_switches[i])) {
38 found_enable_proxy_switch = true; 38 found_enable_proxy_switch = true;
39 break; 39 break;
40 } 40 }
41 } 41 }
42 42
43 if (!found_enable_proxy_switch && 43 if (!found_enable_proxy_switch &&
44 !command_line.HasSwitch(switches::kNoProxyServer)) { 44 !command_line.HasSwitch(switches::kNoProxyServer)) {
45 return NULL; 45 return NULL;
46 } 46 }
47 47
48 net::ProxyConfig* proxy_config = new net::ProxyConfig(); 48 net::ProxyConfig* proxy_config = new net::ProxyConfig();
49 if (command_line.HasSwitch(switches::kNoProxyServer)) { 49 if (command_line.HasSwitch(switches::kNoProxyServer)) {
50 // Ignore (and warn about) all the other proxy config switches we get if 50 // Ignore (and warn about) all the other proxy config switches we get if
51 // the no-proxy-server command line argument is present. 51 // the --no-proxy-server command line argument is present.
52 if (found_enable_proxy_switch) { 52 if (found_enable_proxy_switch) {
53 LOG(WARNING) << "Additional command line proxy switches found when --" 53 LOG(WARNING) << "Additional command line proxy switches found when --"
54 << switches::kNoProxyServer << " was specified."; 54 << switches::kNoProxyServer << " was specified.";
55 } 55 }
56 return proxy_config; 56 return proxy_config;
57 } 57 }
58 58
59 if (command_line.HasSwitch(switches::kProxyServer)) { 59 if (command_line.HasSwitch(switches::kProxyServer)) {
60 const std::wstring& proxy_server = 60 const std::wstring& proxy_server =
61 command_line.GetSwitchValue(switches::kProxyServer); 61 command_line.GetSwitchValue(switches::kProxyServer);
62 proxy_config->proxy_rules.ParseFromString(WideToASCII(proxy_server)); 62 proxy_config->proxy_rules.ParseFromString(WideToASCII(proxy_server));
63 } 63 }
64 64
65 if (command_line.HasSwitch(switches::kProxyServerPacUrl)) { 65 if (command_line.HasSwitch(switches::kProxyPacUrl)) {
66 proxy_config->pac_url = 66 proxy_config->pac_url =
67 GURL(WideToASCII(command_line.GetSwitchValue( 67 GURL(WideToASCII(command_line.GetSwitchValue(
68 switches::kProxyServerPacUrl))); 68 switches::kProxyPacUrl)));
69 } 69 }
70 70
71 if (command_line.HasSwitch(switches::kProxyServerAutoDetect)) { 71 if (command_line.HasSwitch(switches::kProxyAutoDetect)) {
72 proxy_config->auto_detect = true; 72 proxy_config->auto_detect = true;
73 } 73 }
74 74
75 if (command_line.HasSwitch(switches::kProxyServerBypassUrls)) { 75 if (command_line.HasSwitch(switches::kProxyBypassUrls)) {
76 proxy_config->ParseNoProxyList( 76 proxy_config->ParseNoProxyList(
77 WideToASCII(command_line.GetSwitchValue( 77 WideToASCII(command_line.GetSwitchValue(
78 switches::kProxyServerBypassUrls))); 78 switches::kProxyBypassUrls)));
79 } 79 }
80 80
81 return proxy_config; 81 return proxy_config;
82 } 82 }
83 83
84 // Create a proxy service according to the options on command line. 84 // Create a proxy service according to the options on command line.
85 static net::ProxyService* CreateProxyService(URLRequestContext* context, 85 static net::ProxyService* CreateProxyService(URLRequestContext* context,
86 const CommandLine& command_line) { 86 const CommandLine& command_line) {
87 scoped_ptr<net::ProxyConfig> proxy_config(CreateProxyConfig(command_line)); 87 scoped_ptr<net::ProxyConfig> proxy_config(CreateProxyConfig(command_line));
88 88
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 // Do not delete the cookie store in the case of the media context, as it is 376 // Do not delete the cookie store in the case of the media context, as it is
377 // owned by the original context. 377 // owned by the original context.
378 if (!is_media_) 378 if (!is_media_)
379 delete cookie_store_; 379 delete cookie_store_;
380 380
381 // Do not delete the proxy service in the case of OTR or media contexts, as 381 // Do not delete the proxy service in the case of OTR or media contexts, as
382 // it is owned by the original URLRequestContext. 382 // it is owned by the original URLRequestContext.
383 if (!is_off_the_record_ && !is_media_) 383 if (!is_off_the_record_ && !is_media_)
384 delete proxy_service_; 384 delete proxy_service_;
385 } 385 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698