OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "chromeos/network/proxy/ui_proxy_config.h" | 5 #include "chromeos/network/proxy/ui_proxy_config.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "components/proxy_config/proxy_config_dictionary.h" | 9 #include "components/proxy_config/proxy_config_dictionary.h" |
10 #include "net/proxy/proxy_config.h" | 10 #include "net/proxy/proxy_config.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 socks_proxy.server = rules.fallback_proxies.Get(); | 94 socks_proxy.server = rules.fallback_proxies.Get(); |
95 bypass_rules = rules.bypass_rules; | 95 bypass_rules = rules.bypass_rules; |
96 return true; | 96 return true; |
97 default: | 97 default: |
98 NOTREACHED() << "Unrecognized proxy config mode"; | 98 NOTREACHED() << "Unrecognized proxy config mode"; |
99 break; | 99 break; |
100 } | 100 } |
101 return false; | 101 return false; |
102 } | 102 } |
103 | 103 |
104 base::DictionaryValue* UIProxyConfig::ToPrefProxyConfig() const { | 104 std::unique_ptr<base::DictionaryValue> UIProxyConfig::ToPrefProxyConfig() |
| 105 const { |
105 switch (mode) { | 106 switch (mode) { |
106 case MODE_DIRECT: { | 107 case MODE_DIRECT: { |
107 return ProxyConfigDictionary::CreateDirect(); | 108 return ProxyConfigDictionary::CreateDirect(); |
108 } | 109 } |
109 case MODE_AUTO_DETECT: { | 110 case MODE_AUTO_DETECT: { |
110 return ProxyConfigDictionary::CreateAutoDetect(); | 111 return ProxyConfigDictionary::CreateAutoDetect(); |
111 } | 112 } |
112 case MODE_PAC_SCRIPT: { | 113 case MODE_PAC_SCRIPT: { |
113 return ProxyConfigDictionary::CreatePacScript( | 114 return ProxyConfigDictionary::CreatePacScript( |
114 automatic_proxy.pac_url.spec(), false); | 115 automatic_proxy.pac_url.spec(), false); |
(...skipping 15 matching lines...) Expand all Loading... |
130 url::kFtpScheme, ftp_proxy.server, &spec); | 131 url::kFtpScheme, ftp_proxy.server, &spec); |
131 ProxyConfigDictionary::EncodeAndAppendProxyServer( | 132 ProxyConfigDictionary::EncodeAndAppendProxyServer( |
132 kSocksScheme, socks_proxy.server, &spec); | 133 kSocksScheme, socks_proxy.server, &spec); |
133 return ProxyConfigDictionary::CreateFixedServers(spec, | 134 return ProxyConfigDictionary::CreateFixedServers(spec, |
134 bypass_rules.ToString()); | 135 bypass_rules.ToString()); |
135 } | 136 } |
136 default: | 137 default: |
137 break; | 138 break; |
138 } | 139 } |
139 NOTREACHED() << "Unrecognized proxy config mode for preference"; | 140 NOTREACHED() << "Unrecognized proxy config mode for preference"; |
140 return NULL; | 141 return nullptr; |
141 } | 142 } |
142 | 143 |
143 UIProxyConfig::ManualProxy* UIProxyConfig::MapSchemeToProxy( | 144 UIProxyConfig::ManualProxy* UIProxyConfig::MapSchemeToProxy( |
144 const std::string& scheme) { | 145 const std::string& scheme) { |
145 if (scheme == url::kHttpScheme) | 146 if (scheme == url::kHttpScheme) |
146 return &http_proxy; | 147 return &http_proxy; |
147 if (scheme == url::kHttpsScheme) | 148 if (scheme == url::kHttpsScheme) |
148 return &https_proxy; | 149 return &https_proxy; |
149 if (scheme == url::kFtpScheme) | 150 if (scheme == url::kFtpScheme) |
150 return &ftp_proxy; | 151 return &ftp_proxy; |
151 if (scheme == kSocksScheme) | 152 if (scheme == kSocksScheme) |
152 return &socks_proxy; | 153 return &socks_proxy; |
153 NOTREACHED() << "Invalid scheme: " << scheme; | 154 NOTREACHED() << "Invalid scheme: " << scheme; |
154 return NULL; | 155 return NULL; |
155 } | 156 } |
156 | 157 |
157 } // namespace chromeos | 158 } // namespace chromeos |
OLD | NEW |