OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_INIT_PROXY_RESOLVER_H_ | 5 #ifndef NET_PROXY_INIT_PROXY_RESOLVER_H_ |
6 #define NET_PROXY_INIT_PROXY_RESOLVER_H_ | 6 #define NET_PROXY_INIT_PROXY_RESOLVER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 // written out to |*effective_config|. Note that this may differ from | 56 // written out to |*effective_config|. Note that this may differ from |
57 // |config| since we will have stripped any manual settings, and decided | 57 // |config| since we will have stripped any manual settings, and decided |
58 // whether to use auto-detect or the custom PAC URL. Finally, if auto-detect | 58 // whether to use auto-detect or the custom PAC URL. Finally, if auto-detect |
59 // was used we may now have resolved that to a specific script URL. | 59 // was used we may now have resolved that to a specific script URL. |
60 int Init(const ProxyConfig& config, | 60 int Init(const ProxyConfig& config, |
61 const base::TimeDelta wait_delay, | 61 const base::TimeDelta wait_delay, |
62 ProxyConfig* effective_config, | 62 ProxyConfig* effective_config, |
63 CompletionCallback* callback); | 63 CompletionCallback* callback); |
64 | 64 |
65 private: | 65 private: |
| 66 struct PacURL { |
| 67 PacURL(bool auto_detect, const GURL& url) |
| 68 : auto_detect(auto_detect), url(url) {} |
| 69 bool auto_detect; |
| 70 GURL url; |
| 71 }; |
| 72 |
| 73 typedef std::vector<PacURL> UrlList; |
| 74 |
66 enum State { | 75 enum State { |
67 STATE_NONE, | 76 STATE_NONE, |
68 STATE_WAIT, | 77 STATE_WAIT, |
69 STATE_WAIT_COMPLETE, | 78 STATE_WAIT_COMPLETE, |
70 STATE_FETCH_PAC_SCRIPT, | 79 STATE_FETCH_PAC_SCRIPT, |
71 STATE_FETCH_PAC_SCRIPT_COMPLETE, | 80 STATE_FETCH_PAC_SCRIPT_COMPLETE, |
72 STATE_SET_PAC_SCRIPT, | 81 STATE_SET_PAC_SCRIPT, |
73 STATE_SET_PAC_SCRIPT_COMPLETE, | 82 STATE_SET_PAC_SCRIPT_COMPLETE, |
74 }; | 83 }; |
75 | 84 |
76 struct PacURL { | |
77 PacURL(bool auto_detect, const GURL& url) | |
78 : auto_detect(auto_detect), url(url) {} | |
79 bool auto_detect; | |
80 GURL url; | |
81 }; | |
82 | |
83 typedef std::vector<PacURL> UrlList; | |
84 | |
85 // Returns ordered list of PAC urls to try for |config|. | 85 // Returns ordered list of PAC urls to try for |config|. |
86 UrlList BuildPacUrlsFallbackList(const ProxyConfig& config) const; | 86 UrlList BuildPacUrlsFallbackList(const ProxyConfig& config) const; |
87 | 87 |
88 void OnIOCompletion(int result); | 88 void OnIOCompletion(int result); |
89 int DoLoop(int result); | 89 int DoLoop(int result); |
90 void DoCallback(int result); | 90 void DoCallback(int result); |
91 | 91 |
92 int DoWait(); | 92 int DoWait(); |
93 int DoWaitComplete(int result); | 93 int DoWaitComplete(int result); |
94 | 94 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 base::OneShotTimer<InitProxyResolver> wait_timer_; | 135 base::OneShotTimer<InitProxyResolver> wait_timer_; |
136 | 136 |
137 ProxyConfig* effective_config_; | 137 ProxyConfig* effective_config_; |
138 | 138 |
139 DISALLOW_COPY_AND_ASSIGN(InitProxyResolver); | 139 DISALLOW_COPY_AND_ASSIGN(InitProxyResolver); |
140 }; | 140 }; |
141 | 141 |
142 } // namespace net | 142 } // namespace net |
143 | 143 |
144 #endif // NET_PROXY_INIT_PROXY_RESOLVER_H_ | 144 #endif // NET_PROXY_INIT_PROXY_RESOLVER_H_ |
OLD | NEW |