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_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 "net/proxy/proxy_config.h" | 10 #include "net/proxy/proxy_config.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } | 43 } |
44 | 44 |
45 // Returns true if this proxy info specifies a direct connection. | 45 // Returns true if this proxy info specifies a direct connection. |
46 bool is_direct() const { | 46 bool is_direct() const { |
47 // We don't implicitly fallback to DIRECT unless it was added to the list. | 47 // We don't implicitly fallback to DIRECT unless it was added to the list. |
48 if (is_empty()) | 48 if (is_empty()) |
49 return false; | 49 return false; |
50 return proxy_list_.Get().is_direct(); | 50 return proxy_list_.Get().is_direct(); |
51 } | 51 } |
52 | 52 |
| 53 // Returns true if the first valid proxy server is a http proxy. |
| 54 bool is_http() const { |
| 55 if (is_empty()) |
| 56 return false; |
| 57 return proxy_server().is_http(); |
| 58 } |
| 59 |
| 60 // Returns true if the first valid proxy server is a socks server. |
| 61 bool is_socks() const { |
| 62 if (is_empty()) |
| 63 return false; |
| 64 return proxy_server().is_socks(); |
| 65 } |
| 66 |
53 // Returns true if this proxy info has no proxies left to try. | 67 // Returns true if this proxy info has no proxies left to try. |
54 bool is_empty() const { | 68 bool is_empty() const { |
55 return proxy_list_.IsEmpty(); | 69 return proxy_list_.IsEmpty(); |
56 } | 70 } |
57 | 71 |
58 // Returns the first valid proxy server. is_empty() must be false to be able | 72 // Returns the first valid proxy server. is_empty() must be false to be able |
59 // to call this function. | 73 // to call this function. |
60 ProxyServer proxy_server() const { return proxy_list_.Get(); } | 74 ProxyServer proxy_server() const { return proxy_list_.Get(); } |
61 | 75 |
62 // See description in ProxyList::ToPacString(). | 76 // See description in ProxyList::ToPacString(). |
(...skipping 23 matching lines...) Expand all Loading... |
86 // try. If proxy_list_ is empty, then there is nothing left to fall back to. | 100 // try. If proxy_list_ is empty, then there is nothing left to fall back to. |
87 ProxyList proxy_list_; | 101 ProxyList proxy_list_; |
88 | 102 |
89 // This value identifies the proxy config used to initialize this object. | 103 // This value identifies the proxy config used to initialize this object. |
90 ProxyConfig::ID config_id_; | 104 ProxyConfig::ID config_id_; |
91 }; | 105 }; |
92 | 106 |
93 } // namespace net | 107 } // namespace net |
94 | 108 |
95 #endif // NET_PROXY_PROXY_INFO_H_ | 109 #endif // NET_PROXY_PROXY_INFO_H_ |
OLD | NEW |