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 |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "base/timer/timer.h" | 14 #include "base/timer/timer.h" |
15 #include "net/base/address_list.h" | |
15 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
16 #include "net/base/net_export.h" | 17 #include "net/base/net_export.h" |
17 #include "net/base/net_log.h" | 18 #include "net/base/net_log.h" |
19 #include "net/dns/host_resolver.h" | |
20 #include "net/dns/single_request_host_resolver.h" | |
18 #include "net/proxy/proxy_config.h" | 21 #include "net/proxy/proxy_config.h" |
19 #include "net/proxy/proxy_resolver.h" | 22 #include "net/proxy/proxy_resolver.h" |
20 #include "url/gurl.h" | 23 #include "url/gurl.h" |
21 | 24 |
22 namespace net { | 25 namespace net { |
23 | 26 |
24 class DhcpProxyScriptFetcher; | 27 class DhcpProxyScriptFetcher; |
25 class NetLogParameter; | 28 class NetLogParameter; |
26 class ProxyResolver; | 29 class ProxyResolver; |
27 class ProxyScriptFetcher; | 30 class ProxyScriptFetcher; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 NetLog::LogLevel log_level) const; | 99 NetLog::LogLevel log_level) const; |
97 | 100 |
98 Type type; | 101 Type type; |
99 GURL url; // Empty unless |type == PAC_SOURCE_CUSTOM|. | 102 GURL url; // Empty unless |type == PAC_SOURCE_CUSTOM|. |
100 }; | 103 }; |
101 | 104 |
102 typedef std::vector<PacSource> PacSourceList; | 105 typedef std::vector<PacSource> PacSourceList; |
103 | 106 |
104 enum State { | 107 enum State { |
105 STATE_NONE, | 108 STATE_NONE, |
109 STATE_QUICK_CHECK, | |
szym
2013/08/23 20:45:57
nit: these should be after STATE_WAIT
Elly Fong-Jones
2013/08/26 15:17:29
Done.
| |
110 STATE_QUICK_CHECK_COMPLETE, | |
106 STATE_WAIT, | 111 STATE_WAIT, |
107 STATE_WAIT_COMPLETE, | 112 STATE_WAIT_COMPLETE, |
108 STATE_FETCH_PAC_SCRIPT, | 113 STATE_FETCH_PAC_SCRIPT, |
109 STATE_FETCH_PAC_SCRIPT_COMPLETE, | 114 STATE_FETCH_PAC_SCRIPT_COMPLETE, |
110 STATE_VERIFY_PAC_SCRIPT, | 115 STATE_VERIFY_PAC_SCRIPT, |
111 STATE_VERIFY_PAC_SCRIPT_COMPLETE, | 116 STATE_VERIFY_PAC_SCRIPT_COMPLETE, |
117 STATE_FAILED, | |
112 }; | 118 }; |
113 | 119 |
114 // Returns ordered list of PAC urls to try for |config|. | 120 // Returns ordered list of PAC urls to try for |config|. |
115 PacSourceList BuildPacSourcesFallbackList(const ProxyConfig& config) const; | 121 PacSourceList BuildPacSourcesFallbackList(const ProxyConfig& config) const; |
116 | 122 |
117 void OnIOCompletion(int result); | 123 void OnIOCompletion(int result); |
118 int DoLoop(int result); | 124 int DoLoop(int result); |
119 void DoCallback(int result); | 125 void DoCallback(int result); |
120 | 126 |
127 int DoQuickCheck(); | |
szym
2013/08/23 20:45:57
nit: these should be after DoWait()
Elly Fong-Jones
2013/08/26 15:17:29
Done.
| |
128 int DoQuickCheckComplete(int result); | |
129 | |
121 int DoWait(); | 130 int DoWait(); |
122 int DoWaitComplete(int result); | 131 int DoWaitComplete(int result); |
123 | 132 |
124 int DoFetchPacScript(); | 133 int DoFetchPacScript(); |
125 int DoFetchPacScriptComplete(int result); | 134 int DoFetchPacScriptComplete(int result); |
126 | 135 |
127 int DoVerifyPacScript(); | 136 int DoVerifyPacScript(); |
128 int DoVerifyPacScriptComplete(int result); | 137 int DoVerifyPacScriptComplete(int result); |
129 | 138 |
130 // Tries restarting using the next fallback PAC URL: | 139 // Tries restarting using the next fallback PAC URL: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
168 | 177 |
169 bool fetch_pac_bytes_; | 178 bool fetch_pac_bytes_; |
170 | 179 |
171 base::TimeDelta wait_delay_; | 180 base::TimeDelta wait_delay_; |
172 base::OneShotTimer<ProxyScriptDecider> wait_timer_; | 181 base::OneShotTimer<ProxyScriptDecider> wait_timer_; |
173 | 182 |
174 // Results. | 183 // Results. |
175 ProxyConfig effective_config_; | 184 ProxyConfig effective_config_; |
176 scoped_refptr<ProxyResolverScriptData> script_data_; | 185 scoped_refptr<ProxyResolverScriptData> script_data_; |
177 | 186 |
187 AddressList wpad_addrs_; | |
szym
2013/08/23 20:45:57
nit: wpad_addresses_
Elly Fong-Jones
2013/08/26 15:17:29
Done.
| |
188 base::OneShotTimer<ProxyScriptDecider> quick_check_timer_; | |
189 SingleRequestHostResolver host_resolver_; | |
190 base::Time quick_check_started_; | |
szym
2013/08/23 20:45:57
nit: ...start_time_
Elly Fong-Jones
2013/08/26 15:17:29
Done.
| |
178 | 191 |
179 DISALLOW_COPY_AND_ASSIGN(ProxyScriptDecider); | 192 DISALLOW_COPY_AND_ASSIGN(ProxyScriptDecider); |
180 }; | 193 }; |
181 | 194 |
182 } // namespace net | 195 } // namespace net |
183 | 196 |
184 #endif // NET_PROXY_PROXY_SCRIPT_DECIDER_H_ | 197 #endif // NET_PROXY_PROXY_SCRIPT_DECIDER_H_ |
OLD | NEW |