OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef NET_PROXY_PROXY_SERVICE_H_ | 5 #ifndef NET_PROXY_PROXY_SERVICE_H_ |
6 #define NET_PROXY_PROXY_SERVICE_H_ | 6 #define NET_PROXY_PROXY_SERVICE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 URLRequestContext* url_request_context, | 171 URLRequestContext* url_request_context, |
172 NetLog* net_log, | 172 NetLog* net_log, |
173 MessageLoop* io_loop); | 173 MessageLoop* io_loop); |
174 | 174 |
175 // Convenience method that creates a proxy service using the | 175 // Convenience method that creates a proxy service using the |
176 // specified fixed settings. |pc| must not be NULL. | 176 // specified fixed settings. |pc| must not be NULL. |
177 static ProxyService* CreateFixed(const ProxyConfig& pc); | 177 static ProxyService* CreateFixed(const ProxyConfig& pc); |
178 | 178 |
179 // Creates a proxy service that always fails to fetch the proxy configuration, | 179 // Creates a proxy service that always fails to fetch the proxy configuration, |
180 // so it falls back to direct connect. | 180 // so it falls back to direct connect. |
| 181 // TODO(eroman): Rename to CreateDirect(). |
181 static ProxyService* CreateNull(); | 182 static ProxyService* CreateNull(); |
182 | 183 |
| 184 // This method is used by tests to create a ProxyService that returns a |
| 185 // hardcoded proxy fallback list (|pac_string|) for every URL. |
| 186 // |
| 187 // |pac_string| is a list of proxy servers, in the format that a PAC script |
| 188 // would return it. For example, "PROXY foobar:99; SOCKS fml:2; DIRECT" |
| 189 static ProxyService* CreateFixedFromPacResult(const std::string& pac_string); |
| 190 |
183 // Creates a config service appropriate for this platform that fetches the | 191 // Creates a config service appropriate for this platform that fetches the |
184 // system proxy settings. | 192 // system proxy settings. |
185 static ProxyConfigService* CreateSystemProxyConfigService( | 193 static ProxyConfigService* CreateSystemProxyConfigService( |
186 MessageLoop* io_loop, MessageLoop* file_loop); | 194 MessageLoop* io_loop, MessageLoop* file_loop); |
187 | 195 |
188 private: | 196 private: |
189 friend class base::RefCountedThreadSafe<ProxyService>; | 197 friend class base::RefCountedThreadSafe<ProxyService>; |
190 FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigAfterFailedAutodetect); | 198 FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigAfterFailedAutodetect); |
191 FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigFromPACToDirect); | 199 FRIEND_TEST_ALL_PREFIXES(ProxyServiceTest, UpdateConfigFromPACToDirect); |
192 friend class PacRequest; | 200 friend class PacRequest; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 | 334 |
327 base::WaitableEvent event_; | 335 base::WaitableEvent event_; |
328 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; | 336 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; |
329 ProxyInfo proxy_info_; | 337 ProxyInfo proxy_info_; |
330 int result_; | 338 int result_; |
331 }; | 339 }; |
332 | 340 |
333 } // namespace net | 341 } // namespace net |
334 | 342 |
335 #endif // NET_PROXY_PROXY_SERVICE_H_ | 343 #endif // NET_PROXY_PROXY_SERVICE_H_ |
OLD | NEW |