OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 ProxyScriptFetcher* GetProxyScriptFetcher() const; | 179 ProxyScriptFetcher* GetProxyScriptFetcher() const; |
180 | 180 |
181 // Tells this ProxyService to start using a new ProxyConfigService to | 181 // Tells this ProxyService to start using a new ProxyConfigService to |
182 // retrieve its ProxyConfig from. The new ProxyConfigService will immediately | 182 // retrieve its ProxyConfig from. The new ProxyConfigService will immediately |
183 // be queried for new config info which will be used for all subsequent | 183 // be queried for new config info which will be used for all subsequent |
184 // ResolveProxy calls. ProxyService takes ownership of | 184 // ResolveProxy calls. ProxyService takes ownership of |
185 // |new_proxy_config_service|. | 185 // |new_proxy_config_service|. |
186 void ResetConfigService(ProxyConfigService* new_proxy_config_service); | 186 void ResetConfigService(ProxyConfigService* new_proxy_config_service); |
187 | 187 |
188 // Returns the last configuration fetched from ProxyConfigService. | 188 // Returns the last configuration fetched from ProxyConfigService. |
189 const ProxyConfig& fetched_config() { | 189 const ProxyConfig& fetched_config() { return fetched_config_; } |
190 return fetched_config_; | |
191 } | |
192 | 190 |
193 // Returns the current configuration being used by ProxyConfigService. | 191 // Returns the current configuration being used by ProxyConfigService. |
194 const ProxyConfig& config() { | 192 const ProxyConfig& config() { return config_; } |
195 return config_; | |
196 } | |
197 | 193 |
198 // Returns the map of proxies which have been marked as "bad". | 194 // Returns the map of proxies which have been marked as "bad". |
199 const ProxyRetryInfoMap& proxy_retry_info() const { | 195 const ProxyRetryInfoMap& proxy_retry_info() const { |
200 return proxy_retry_info_; | 196 return proxy_retry_info_; |
201 } | 197 } |
202 | 198 |
203 // Clears the list of bad proxy servers that has been cached. | 199 // Clears the list of bad proxy servers that has been cached. |
204 void ClearBadProxiesCache() { | 200 void ClearBadProxiesCache() { proxy_retry_info_.clear(); } |
205 proxy_retry_info_.clear(); | |
206 } | |
207 | 201 |
208 // Forces refetching the proxy configuration, and applying it. | 202 // Forces refetching the proxy configuration, and applying it. |
209 // This re-does everything from fetching the system configuration, | 203 // This re-does everything from fetching the system configuration, |
210 // to downloading and testing the PAC files. | 204 // to downloading and testing the PAC files. |
211 void ForceReloadProxyConfig(); | 205 void ForceReloadProxyConfig(); |
212 | 206 |
213 // Same as CreateProxyServiceUsingV8ProxyResolver, except it uses system | 207 // Same as CreateProxyServiceUsingV8ProxyResolver, except it uses system |
214 // libraries for evaluating the PAC script if available, otherwise skips | 208 // libraries for evaluating the PAC script if available, otherwise skips |
215 // proxy autoconfig. | 209 // proxy autoconfig. |
216 static ProxyService* CreateUsingSystemProxyResolver( | 210 static ProxyService* CreateUsingSystemProxyResolver( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 | 247 |
254 // This method should only be used by unit tests. Returns the previously | 248 // This method should only be used by unit tests. Returns the previously |
255 // active policy. | 249 // active policy. |
256 static const PacPollPolicy* set_pac_script_poll_policy( | 250 static const PacPollPolicy* set_pac_script_poll_policy( |
257 const PacPollPolicy* policy); | 251 const PacPollPolicy* policy); |
258 | 252 |
259 // This method should only be used by unit tests. Creates an instance | 253 // This method should only be used by unit tests. Creates an instance |
260 // of the default internal PacPollPolicy used by ProxyService. | 254 // of the default internal PacPollPolicy used by ProxyService. |
261 static scoped_ptr<PacPollPolicy> CreateDefaultPacPollPolicy(); | 255 static scoped_ptr<PacPollPolicy> CreateDefaultPacPollPolicy(); |
262 | 256 |
263 void set_quick_check_enabled(bool value) { | 257 void set_quick_check_enabled(bool value) { quick_check_enabled_ = value; } |
264 quick_check_enabled_ = value; | |
265 } | |
266 | 258 |
267 bool quick_check_enabled() const { return quick_check_enabled_; } | 259 bool quick_check_enabled() const { return quick_check_enabled_; } |
268 | 260 |
269 #if defined(SPDY_PROXY_AUTH_ORIGIN) | 261 #if defined(SPDY_PROXY_AUTH_ORIGIN) |
270 // Values of the UMA DataReductionProxy.BypassInfo{Primary|Fallback} | 262 // Values of the UMA DataReductionProxy.BypassInfo{Primary|Fallback} |
271 // histograms. This enum must remain synchronized with the enum of the same | 263 // histograms. This enum must remain synchronized with the enum of the same |
272 // name in metrics/histograms/histograms.xml. | 264 // name in metrics/histograms/histograms.xml. |
273 enum DataReductionProxyBypassEventType { | 265 enum DataReductionProxyBypassEventType { |
274 // Bypass the proxy for less than 30 minutes. | 266 // Bypass the proxy for less than 30 minutes. |
275 SHORT_BYPASS = 0, | 267 SHORT_BYPASS = 0, |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 // asynchronously). Handles logging the result, and cleaning out | 349 // asynchronously). Handles logging the result, and cleaning out |
358 // bad entries from the results list. | 350 // bad entries from the results list. |
359 int DidFinishResolvingProxy(ProxyInfo* result, | 351 int DidFinishResolvingProxy(ProxyInfo* result, |
360 int result_code, | 352 int result_code, |
361 const BoundNetLog& net_log); | 353 const BoundNetLog& net_log); |
362 | 354 |
363 // Start initialization using |fetched_config_|. | 355 // Start initialization using |fetched_config_|. |
364 void InitializeUsingLastFetchedConfig(); | 356 void InitializeUsingLastFetchedConfig(); |
365 | 357 |
366 // Start the initialization skipping past the "decision" phase. | 358 // Start the initialization skipping past the "decision" phase. |
367 void InitializeUsingDecidedConfig( | 359 void InitializeUsingDecidedConfig(int decider_result, |
368 int decider_result, | 360 ProxyResolverScriptData* script_data, |
369 ProxyResolverScriptData* script_data, | 361 const ProxyConfig& effective_config); |
370 const ProxyConfig& effective_config); | |
371 | 362 |
372 // NetworkChangeNotifier::IPAddressObserver | 363 // NetworkChangeNotifier::IPAddressObserver |
373 // When this is called, we re-fetch PAC scripts and re-run WPAD. | 364 // When this is called, we re-fetch PAC scripts and re-run WPAD. |
374 virtual void OnIPAddressChanged() OVERRIDE; | 365 virtual void OnIPAddressChanged() OVERRIDE; |
375 | 366 |
376 // NetworkChangeNotifier::DNSObserver | 367 // NetworkChangeNotifier::DNSObserver |
377 // We respond as above. | 368 // We respond as above. |
378 virtual void OnDNSChanged() OVERRIDE; | 369 virtual void OnDNSChanged() OVERRIDE; |
379 | 370 |
380 // ProxyConfigService::Observer | 371 // ProxyConfigService::Observer |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 | 467 |
477 base::WaitableEvent event_; | 468 base::WaitableEvent event_; |
478 CompletionCallback callback_; | 469 CompletionCallback callback_; |
479 ProxyInfo proxy_info_; | 470 ProxyInfo proxy_info_; |
480 int result_; | 471 int result_; |
481 }; | 472 }; |
482 | 473 |
483 } // namespace net | 474 } // namespace net |
484 | 475 |
485 #endif // NET_PROXY_PROXY_SERVICE_H_ | 476 #endif // NET_PROXY_PROXY_SERVICE_H_ |
OLD | NEW |