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_SERVICE_H_ | 5 #ifndef NET_PROXY_PROXY_SERVICE_H_ |
6 #define NET_PROXY_PROXY_SERVICE_H_ | 6 #define NET_PROXY_PROXY_SERVICE_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
12 #include "base/scoped_ptr.h" | 12 #include "base/scoped_ptr.h" |
13 #include "base/thread.h" | 13 #include "base/thread.h" |
14 #include "base/waitable_event.h" | 14 #include "base/waitable_event.h" |
15 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
16 #include "net/proxy/proxy_server.h" | 16 #include "net/proxy/proxy_server.h" |
17 #include "net/proxy/proxy_info.h" | 17 #include "net/proxy/proxy_info.h" |
18 | 18 |
19 class GURL; | 19 class GURL; |
| 20 class URLRequestContext; |
20 | 21 |
21 namespace net { | 22 namespace net { |
22 | 23 |
23 class ProxyScriptFetcher; | 24 class ProxyScriptFetcher; |
24 class ProxyConfigService; | 25 class ProxyConfigService; |
25 class ProxyResolver; | 26 class ProxyResolver; |
26 | 27 |
27 // This class can be used to resolve the proxy server to use when loading a | 28 // This class can be used to resolve the proxy server to use when loading a |
28 // HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy | 29 // HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy |
29 // resolution. See ProxyResolverWinHttp for example. | 30 // resolution. See ProxyResolverWinHttp for example. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 // Returns ERR_FAILED if there is not another proxy config to try. | 74 // Returns ERR_FAILED if there is not another proxy config to try. |
74 // | 75 // |
75 int ReconsiderProxyAfterError(const GURL& url, | 76 int ReconsiderProxyAfterError(const GURL& url, |
76 ProxyInfo* results, | 77 ProxyInfo* results, |
77 CompletionCallback* callback, | 78 CompletionCallback* callback, |
78 PacRequest** pac_request); | 79 PacRequest** pac_request); |
79 | 80 |
80 // Call this method with a non-null |pac_request| to cancel the PAC request. | 81 // Call this method with a non-null |pac_request| to cancel the PAC request. |
81 void CancelPacRequest(PacRequest* pac_request); | 82 void CancelPacRequest(PacRequest* pac_request); |
82 | 83 |
83 // Set the ProxyScriptFetcher dependency. This is needed if the ProxyResolver | 84 // Sets the ProxyScriptFetcher dependency. This is needed if the ProxyResolver |
84 // is of type ProxyResolverWithoutFetch. ProxyService takes ownership of | 85 // is of type ProxyResolverWithoutFetch. ProxyService takes ownership of |
85 // |proxy_script_fetcher|. | 86 // |proxy_script_fetcher|. |
86 void SetProxyScriptFetcher(ProxyScriptFetcher* proxy_script_fetcher); | 87 void SetProxyScriptFetcher(ProxyScriptFetcher* proxy_script_fetcher); |
87 | 88 |
88 // Create a proxy service using the specified settings. If |pi| is NULL then | 89 // Creates a proxy service using the specified settings. If |pi| is NULL then |
89 // the system's default proxy settings will be used (on Windows this will | 90 // the system's default proxy settings will be used (on Windows this will |
90 // use IE's settings). | 91 // use IE's settings). |
91 static ProxyService* Create(const ProxyInfo* pi); | 92 static ProxyService* Create(const ProxyInfo* pi); |
92 | 93 |
93 // Create a proxy service that always fails to fetch the proxy configuration, | 94 // Creates a proxy service using the specified settings. If |pi| is NULL then |
| 95 // the system's default proxy settings will be used. This is basically the |
| 96 // same as Create(const ProxyInfo*), however under the hood it uses a |
| 97 // different implementation (V8). |url_request_context| is the URL request |
| 98 // context that will be used if a PAC script needs to be fetched. |
| 99 // ########################################################################## |
| 100 // # See the warnings in net/proxy/proxy_resolver_v8.h describing the |
| 101 // # multi-threading model. In order for this to be safe to use, *ALL* the |
| 102 // # other V8's running in the process must use v8::Locker. |
| 103 // ########################################################################## |
| 104 static ProxyService* CreateUsingV8Resolver( |
| 105 const ProxyInfo* pi, |
| 106 URLRequestContext* url_request_context); |
| 107 |
| 108 // Creates a proxy service that always fails to fetch the proxy configuration, |
94 // so it falls back to direct connect. | 109 // so it falls back to direct connect. |
95 static ProxyService* CreateNull(); | 110 static ProxyService* CreateNull(); |
96 | 111 |
97 private: | 112 private: |
98 friend class PacRequest; | 113 friend class PacRequest; |
99 | 114 |
100 ProxyResolver* resolver() { return resolver_.get(); } | 115 ProxyResolver* resolver() { return resolver_.get(); } |
101 base::Thread* pac_thread() { return pac_thread_.get(); } | 116 base::Thread* pac_thread() { return pac_thread_.get(); } |
102 | 117 |
103 // Identifies the proxy configuration. | 118 // Identifies the proxy configuration. |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 base::WaitableEvent event_; | 236 base::WaitableEvent event_; |
222 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; | 237 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; |
223 ProxyInfo proxy_info_; | 238 ProxyInfo proxy_info_; |
224 int result_; | 239 int result_; |
225 }; | 240 }; |
226 | 241 |
227 } // namespace net | 242 } // namespace net |
228 | 243 |
229 #endif // NET_PROXY_PROXY_SERVICE_H_ | 244 #endif // NET_PROXY_PROXY_SERVICE_H_ |
230 | 245 |
OLD | NEW |