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_SCRIPT_DECIDER_H_ | 5 #ifndef NET_PROXY_PROXY_SCRIPT_DECIDER_H_ |
6 #define NET_PROXY_PROXY_SCRIPT_DECIDER_H_ | 6 #define NET_PROXY_PROXY_SCRIPT_DECIDER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 int Start(const ProxyConfig& config, | 72 int Start(const ProxyConfig& config, |
73 const base::TimeDelta wait_delay, | 73 const base::TimeDelta wait_delay, |
74 bool fetch_pac_bytes, | 74 bool fetch_pac_bytes, |
75 const net::CompletionCallback& callback); | 75 const net::CompletionCallback& callback); |
76 | 76 |
77 const ProxyConfig& effective_config() const; | 77 const ProxyConfig& effective_config() const; |
78 | 78 |
79 // TODO(eroman): Return a const-pointer. | 79 // TODO(eroman): Return a const-pointer. |
80 ProxyResolverScriptData* script_data() const; | 80 ProxyResolverScriptData* script_data() const; |
81 | 81 |
82 void set_quick_check_enabled(bool enabled) { | 82 void set_quick_check_enabled(bool enabled) { quick_check_enabled_ = enabled; } |
83 quick_check_enabled_ = enabled; | |
84 } | |
85 | 83 |
86 bool quick_check_enabled() const { return quick_check_enabled_; } | 84 bool quick_check_enabled() const { return quick_check_enabled_; } |
87 | 85 |
88 private: | 86 private: |
89 // Represents the sources from which we can get PAC files; two types of | 87 // Represents the sources from which we can get PAC files; two types of |
90 // auto-detect or a custom URL. | 88 // auto-detect or a custom URL. |
91 struct PacSource { | 89 struct PacSource { |
92 enum Type { | 90 enum Type { WPAD_DHCP, WPAD_DNS, CUSTOM }; |
93 WPAD_DHCP, | |
94 WPAD_DNS, | |
95 CUSTOM | |
96 }; | |
97 | 91 |
98 PacSource(Type type, const GURL& url) | 92 PacSource(Type type, const GURL& url) : type(type), url(url) {} |
99 : type(type), url(url) {} | |
100 | 93 |
101 // Returns a Value representing the PacSource. |effective_pac_url| must | 94 // Returns a Value representing the PacSource. |effective_pac_url| must |
102 // be non-NULL and point to the URL derived from information contained in | 95 // be non-NULL and point to the URL derived from information contained in |
103 // |this|, if Type is not WPAD_DHCP. | 96 // |this|, if Type is not WPAD_DHCP. |
104 base::Value* NetLogCallback(const GURL* effective_pac_url, | 97 base::Value* NetLogCallback(const GURL* effective_pac_url, |
105 NetLog::LogLevel log_level) const; | 98 NetLog::LogLevel log_level) const; |
106 | 99 |
107 Type type; | 100 Type type; |
108 GURL url; // Empty unless |type == PAC_SOURCE_CUSTOM|. | 101 GURL url; // Empty unless |type == PAC_SOURCE_CUSTOM|. |
109 }; | 102 }; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 base::OneShotTimer<ProxyScriptDecider> quick_check_timer_; | 192 base::OneShotTimer<ProxyScriptDecider> quick_check_timer_; |
200 scoped_ptr<SingleRequestHostResolver> host_resolver_; | 193 scoped_ptr<SingleRequestHostResolver> host_resolver_; |
201 base::Time quick_check_start_time_; | 194 base::Time quick_check_start_time_; |
202 | 195 |
203 DISALLOW_COPY_AND_ASSIGN(ProxyScriptDecider); | 196 DISALLOW_COPY_AND_ASSIGN(ProxyScriptDecider); |
204 }; | 197 }; |
205 | 198 |
206 } // namespace net | 199 } // namespace net |
207 | 200 |
208 #endif // NET_PROXY_PROXY_SCRIPT_DECIDER_H_ | 201 #endif // NET_PROXY_PROXY_SCRIPT_DECIDER_H_ |
OLD | NEW |