OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
12 #include "net/base/completion_callback.h" | 12 #include "net/base/completion_callback.h" |
| 13 #include "net/base/net_log.h" |
13 | 14 |
14 namespace net { | 15 namespace net { |
15 | 16 |
16 class LoadLog; | 17 class BoundNetLog; |
17 class ProxyConfig; | 18 class ProxyConfig; |
18 class ProxyResolver; | 19 class ProxyResolver; |
19 class ProxyScriptFetcher; | 20 class ProxyScriptFetcher; |
20 | 21 |
21 // InitProxyResolver is a helper class used by ProxyService to | 22 // InitProxyResolver is a helper class used by ProxyService to |
22 // initialize a ProxyResolver with the PAC script data specified | 23 // initialize a ProxyResolver with the PAC script data specified |
23 // by a particular ProxyConfig. | 24 // by a particular ProxyConfig. |
24 // | 25 // |
25 // This involves trying to use PAC scripts in this order: | 26 // This involves trying to use PAC scripts in this order: |
26 // | 27 // |
(...skipping 13 matching lines...) Expand all Loading... |
40 // the lifespan of InitProxyResolver. | 41 // the lifespan of InitProxyResolver. |
41 InitProxyResolver(ProxyResolver* resolver, | 42 InitProxyResolver(ProxyResolver* resolver, |
42 ProxyScriptFetcher* proxy_script_fetcher); | 43 ProxyScriptFetcher* proxy_script_fetcher); |
43 | 44 |
44 // Aborts any in-progress request. | 45 // Aborts any in-progress request. |
45 ~InitProxyResolver(); | 46 ~InitProxyResolver(); |
46 | 47 |
47 // Apply the PAC settings of |config| to |resolver_|. | 48 // Apply the PAC settings of |config| to |resolver_|. |
48 int Init(const ProxyConfig& config, | 49 int Init(const ProxyConfig& config, |
49 CompletionCallback* callback, | 50 CompletionCallback* callback, |
50 LoadLog* load_log); | 51 const BoundNetLog& net_log); |
51 | 52 |
52 private: | 53 private: |
53 enum State { | 54 enum State { |
54 STATE_NONE, | 55 STATE_NONE, |
55 STATE_FETCH_PAC_SCRIPT, | 56 STATE_FETCH_PAC_SCRIPT, |
56 STATE_FETCH_PAC_SCRIPT_COMPLETE, | 57 STATE_FETCH_PAC_SCRIPT_COMPLETE, |
57 STATE_SET_PAC_SCRIPT, | 58 STATE_SET_PAC_SCRIPT, |
58 STATE_SET_PAC_SCRIPT_COMPLETE, | 59 STATE_SET_PAC_SCRIPT_COMPLETE, |
59 }; | 60 }; |
60 typedef std::vector<GURL> UrlList; | 61 typedef std::vector<GURL> UrlList; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 CompletionCallback* user_callback_; | 96 CompletionCallback* user_callback_; |
96 | 97 |
97 size_t current_pac_url_index_; | 98 size_t current_pac_url_index_; |
98 | 99 |
99 // Filled when the PAC script fetch completes. | 100 // Filled when the PAC script fetch completes. |
100 std::string pac_bytes_; | 101 std::string pac_bytes_; |
101 | 102 |
102 UrlList pac_urls_; | 103 UrlList pac_urls_; |
103 State next_state_; | 104 State next_state_; |
104 | 105 |
105 scoped_refptr<LoadLog> load_log_; | 106 BoundNetLog net_log_; |
106 | 107 |
107 DISALLOW_COPY_AND_ASSIGN(InitProxyResolver); | 108 DISALLOW_COPY_AND_ASSIGN(InitProxyResolver); |
108 }; | 109 }; |
109 | 110 |
110 } // namespace net | 111 } // namespace net |
111 | 112 |
112 #endif // NET_PROXY_INIT_PROXY_RESOLVER_H_ | 113 #endif // NET_PROXY_INIT_PROXY_RESOLVER_H_ |
OLD | NEW |