| 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 #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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // |new_proxy_config_service|. | 100 // |new_proxy_config_service|. |
| 101 void ResetConfigService(ProxyConfigService* new_proxy_config_service); | 101 void ResetConfigService(ProxyConfigService* new_proxy_config_service); |
| 102 | 102 |
| 103 // Returns the log for the most recent WPAD + PAC initialization. | 103 // Returns the log for the most recent WPAD + PAC initialization. |
| 104 // (This shows how much time was spent downloading and parsing the | 104 // (This shows how much time was spent downloading and parsing the |
| 105 // PAC scripts for the current configuration). | 105 // PAC scripts for the current configuration). |
| 106 LoadLog* init_proxy_resolver_log() const { | 106 LoadLog* init_proxy_resolver_log() const { |
| 107 return init_proxy_resolver_log_; | 107 return init_proxy_resolver_log_; |
| 108 } | 108 } |
| 109 | 109 |
| 110 // Returns true if we have called UpdateConfig() at least once. |
| 111 bool config_has_been_initialized() const { |
| 112 return config_.id() != ProxyConfig::INVALID_ID; |
| 113 } |
| 114 |
| 115 // Returns the last configuration fetched from ProxyConfigService. |
| 116 const ProxyConfig& config() { |
| 117 return config_; |
| 118 } |
| 119 |
| 110 // Creates a proxy service using the specified settings. If |pc| is NULL then | 120 // Creates a proxy service using the specified settings. If |pc| is NULL then |
| 111 // the system's default proxy settings will be used (on Windows this will | 121 // the system's default proxy settings will be used (on Windows this will |
| 112 // use IE's settings). | 122 // use IE's settings). |
| 113 // Iff |use_v8_resolver| is true, then the V8 implementation is | 123 // Iff |use_v8_resolver| is true, then the V8 implementation is |
| 114 // used. | 124 // used. |
| 115 // |url_request_context| is only used when use_v8_resolver is true: | 125 // |url_request_context| is only used when use_v8_resolver is true: |
| 116 // it specifies the URL request context that will be used if a PAC | 126 // it specifies the URL request context that will be used if a PAC |
| 117 // script needs to be fetched. | 127 // script needs to be fetched. |
| 118 // |io_loop| points to the IO thread's message loop. It is only used | 128 // |io_loop| points to the IO thread's message loop. It is only used |
| 119 // when pc is NULL. If both pc and io_loop are NULL, then monitoring | 129 // when pc is NULL. If both pc and io_loop are NULL, then monitoring |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 static ProxyConfigService* CreateSystemProxyConfigService( | 165 static ProxyConfigService* CreateSystemProxyConfigService( |
| 156 MessageLoop* io_loop, MessageLoop* file_loop); | 166 MessageLoop* io_loop, MessageLoop* file_loop); |
| 157 | 167 |
| 158 // Creates a proxy resolver appropriate for this platform that doesn't rely | 168 // Creates a proxy resolver appropriate for this platform that doesn't rely |
| 159 // on V8. | 169 // on V8. |
| 160 static ProxyResolver* CreateNonV8ProxyResolver(); | 170 static ProxyResolver* CreateNonV8ProxyResolver(); |
| 161 | 171 |
| 162 // Identifies the proxy configuration. | 172 // Identifies the proxy configuration. |
| 163 ProxyConfig::ID config_id() const { return config_.id(); } | 173 ProxyConfig::ID config_id() const { return config_.id(); } |
| 164 | 174 |
| 165 // Returns true if we have called UpdateConfig() at least once. | |
| 166 bool config_has_been_initialized() const { | |
| 167 return config_.id() != ProxyConfig::INVALID_ID; | |
| 168 } | |
| 169 | |
| 170 // Checks to see if the proxy configuration changed, and then updates config_ | 175 // Checks to see if the proxy configuration changed, and then updates config_ |
| 171 // to reference the new configuration. | 176 // to reference the new configuration. |
| 172 void UpdateConfig(); | 177 void UpdateConfig(); |
| 173 | 178 |
| 174 // Assign |config| as the current configuration. | 179 // Assign |config| as the current configuration. |
| 175 void SetConfig(const ProxyConfig& config); | 180 void SetConfig(const ProxyConfig& config); |
| 176 | 181 |
| 177 // Tries to update the configuration if it hasn't been checked in a while. | 182 // Tries to update the configuration if it hasn't been checked in a while. |
| 178 void UpdateConfigIfOld(); | 183 void UpdateConfigIfOld(); |
| 179 | 184 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 | 294 |
| 290 base::WaitableEvent event_; | 295 base::WaitableEvent event_; |
| 291 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; | 296 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; |
| 292 ProxyInfo proxy_info_; | 297 ProxyInfo proxy_info_; |
| 293 int result_; | 298 int result_; |
| 294 }; | 299 }; |
| 295 | 300 |
| 296 } // namespace net | 301 } // namespace net |
| 297 | 302 |
| 298 #endif // NET_PROXY_PROXY_SERVICE_H_ | 303 #endif // NET_PROXY_PROXY_SERVICE_H_ |
| OLD | NEW |