| 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_INFO_H_ | 5 #ifndef NET_PROXY_PROXY_INFO_H_ |
| 6 #define NET_PROXY_PROXY_INFO_H_ | 6 #define NET_PROXY_PROXY_INFO_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/gtest_prod_util.h" |
| 10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 11 #include "net/base/net_export.h" | 12 #include "net/base/net_export.h" |
| 12 #include "net/base/net_log.h" | 13 #include "net/base/net_log.h" |
| 13 #include "net/proxy/proxy_config.h" | 14 #include "net/proxy/proxy_config.h" |
| 14 #include "net/proxy/proxy_list.h" | 15 #include "net/proxy/proxy_list.h" |
| 15 #include "net/proxy/proxy_retry_info.h" | 16 #include "net/proxy/proxy_retry_info.h" |
| 16 #include "net/proxy/proxy_server.h" | 17 #include "net/proxy/proxy_server.h" |
| 17 | 18 |
| 18 namespace net { | 19 namespace net { |
| 19 | 20 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 39 // This may optionally be a semi-colon delimited list of <proxy-uri>. | 40 // This may optionally be a semi-colon delimited list of <proxy-uri>. |
| 40 // It is OK to have LWS between entries. | 41 // It is OK to have LWS between entries. |
| 41 void UseNamedProxy(const std::string& proxy_uri_list); | 42 void UseNamedProxy(const std::string& proxy_uri_list); |
| 42 | 43 |
| 43 // Sets the proxy list to a single entry, |proxy_server|. | 44 // Sets the proxy list to a single entry, |proxy_server|. |
| 44 void UseProxyServer(const ProxyServer& proxy_server); | 45 void UseProxyServer(const ProxyServer& proxy_server); |
| 45 | 46 |
| 46 // Parses from the given PAC result. | 47 // Parses from the given PAC result. |
| 47 void UsePacString(const std::string& pac_string); | 48 void UsePacString(const std::string& pac_string); |
| 48 | 49 |
| 49 // Use the proxies from the given list. | 50 // Uses the proxies from the given list. |
| 50 void UseProxyList(const ProxyList& proxy_list); | 51 void UseProxyList(const ProxyList& proxy_list); |
| 51 | 52 |
| 53 // Uses the proxies from the given list, but does not otherwise reset the |
| 54 // proxy configuration. |
| 55 void OverrideProxyList(const ProxyList& proxy_list); |
| 56 |
| 52 // Returns true if this proxy info specifies a direct connection. | 57 // Returns true if this proxy info specifies a direct connection. |
| 53 bool is_direct() const { | 58 bool is_direct() const { |
| 54 // We don't implicitly fallback to DIRECT unless it was added to the list. | 59 // We don't implicitly fallback to DIRECT unless it was added to the list. |
| 55 if (is_empty()) | 60 if (is_empty()) |
| 56 return false; | 61 return false; |
| 57 return proxy_list_.Get().is_direct(); | 62 return proxy_list_.Get().is_direct(); |
| 58 } | 63 } |
| 59 | 64 |
| 60 bool is_direct_only() const { | 65 bool is_direct_only() const { |
| 61 return is_direct() && proxy_list_.size() == 1 && proxy_retry_info_.empty(); | 66 return is_direct() && proxy_list_.size() == 1 && proxy_retry_info_.empty(); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 base::TimeTicks proxy_resolve_start_time() const { | 144 base::TimeTicks proxy_resolve_start_time() const { |
| 140 return proxy_resolve_start_time_; | 145 return proxy_resolve_start_time_; |
| 141 } | 146 } |
| 142 | 147 |
| 143 base::TimeTicks proxy_resolve_end_time() const { | 148 base::TimeTicks proxy_resolve_end_time() const { |
| 144 return proxy_resolve_end_time_; | 149 return proxy_resolve_end_time_; |
| 145 } | 150 } |
| 146 | 151 |
| 147 private: | 152 private: |
| 148 friend class ProxyService; | 153 friend class ProxyService; |
| 154 FRIEND_TEST_ALL_PREFIXES(ProxyInfoTest, UseVsOverrideProxyList); |
| 149 | 155 |
| 150 const ProxyRetryInfoMap& proxy_retry_info() const { | 156 const ProxyRetryInfoMap& proxy_retry_info() const { |
| 151 return proxy_retry_info_; | 157 return proxy_retry_info_; |
| 152 } | 158 } |
| 153 | 159 |
| 154 // Reset proxy and config settings. | 160 // Reset proxy and config settings. |
| 155 void Reset(); | 161 void Reset(); |
| 156 | 162 |
| 157 // The ordered list of proxy servers (including DIRECT attempts) remaining to | 163 // The ordered list of proxy servers (including DIRECT attempts) remaining to |
| 158 // try. If proxy_list_ is empty, then there is nothing left to fall back to. | 164 // try. If proxy_list_ is empty, then there is nothing left to fall back to. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 175 | 181 |
| 176 // How long it took to resolve the proxy. Times are both null if proxy was | 182 // How long it took to resolve the proxy. Times are both null if proxy was |
| 177 // determined synchronously without running a PAC. | 183 // determined synchronously without running a PAC. |
| 178 base::TimeTicks proxy_resolve_start_time_; | 184 base::TimeTicks proxy_resolve_start_time_; |
| 179 base::TimeTicks proxy_resolve_end_time_; | 185 base::TimeTicks proxy_resolve_end_time_; |
| 180 }; | 186 }; |
| 181 | 187 |
| 182 } // namespace net | 188 } // namespace net |
| 183 | 189 |
| 184 #endif // NET_PROXY_PROXY_INFO_H_ | 190 #endif // NET_PROXY_PROXY_INFO_H_ |
| OLD | NEW |