| 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 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 void CancelPacRequest(PacRequest* pac_request); | 82 void CancelPacRequest(PacRequest* pac_request); |
| 83 | 83 |
| 84 // Sets the ProxyScriptFetcher dependency. This is needed if the ProxyResolver | 84 // Sets the ProxyScriptFetcher dependency. This is needed if the ProxyResolver |
| 85 // is of type ProxyResolverWithoutFetch. ProxyService takes ownership of | 85 // is of type ProxyResolverWithoutFetch. ProxyService takes ownership of |
| 86 // |proxy_script_fetcher|. | 86 // |proxy_script_fetcher|. |
| 87 void SetProxyScriptFetcher(ProxyScriptFetcher* proxy_script_fetcher); | 87 void SetProxyScriptFetcher(ProxyScriptFetcher* proxy_script_fetcher); |
| 88 | 88 |
| 89 // Creates a proxy service using the specified settings. If |pc| is NULL then | 89 // Creates a proxy service using the specified settings. If |pc| is NULL then |
| 90 // 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 |
| 91 // use IE's settings). | 91 // use IE's settings). |
| 92 static ProxyService* Create(const ProxyConfig* pc); | 92 // Iff |use_v8_resolver| is true, then the V8 implementation is |
| 93 | 93 // used. |
| 94 // Creates a proxy service using the specified settings. If |pc| is NULL then | 94 // |url_request_context| is only used when use_v8_resolver is true: |
| 95 // the system's default proxy settings will be used. This is basically the | 95 // it specifies the URL request context that will be used if a PAC |
| 96 // same as Create(const ProxyConfig*), however under the hood it uses a | 96 // script needs to be fetched. |
| 97 // different implementation (V8). |url_request_context| is the URL request | 97 // |io_loop| points to the IO thread's message loop. It is only used |
| 98 // context that will be used if a PAC script needs to be fetched. | 98 // when pc is NULL. If both pc and io_loop are NULL, then monitoring |
| 99 // of gconf setting changes will be disabled in |
| 100 // ProxyConfigServiceLinux. |
| 99 // ########################################################################## | 101 // ########################################################################## |
| 100 // # See the warnings in net/proxy/proxy_resolver_v8.h describing the | 102 // # 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 | 103 // # 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. | 104 // # other V8's running in the process must use v8::Locker. |
| 103 // ########################################################################## | 105 // ########################################################################## |
| 104 static ProxyService* CreateUsingV8Resolver( | 106 static ProxyService* Create( |
| 105 const ProxyConfig* pc, | 107 const ProxyConfig* pc, |
| 106 URLRequestContext* url_request_context); | 108 bool use_v8_resolver, |
| 109 URLRequestContext* url_request_context, |
| 110 MessageLoop* io_loop); |
| 111 |
| 112 // Convenience method that creates a proxy service using the |
| 113 // specified fixed settings. |pc| must not be NULL. |
| 114 static ProxyService* CreateFixed(const ProxyConfig& pc); |
| 107 | 115 |
| 108 // Creates a proxy service that always fails to fetch the proxy configuration, | 116 // Creates a proxy service that always fails to fetch the proxy configuration, |
| 109 // so it falls back to direct connect. | 117 // so it falls back to direct connect. |
| 110 static ProxyService* CreateNull(); | 118 static ProxyService* CreateNull(); |
| 111 | 119 |
| 112 private: | 120 private: |
| 113 friend class PacRequest; | 121 friend class PacRequest; |
| 114 | 122 |
| 115 // Creates a config service appropriate for this platform that fetches the | 123 // Creates a config service appropriate for this platform that fetches the |
| 116 // system proxy settings. | 124 // system proxy settings. |
| 117 static ProxyConfigService* CreateSystemProxyConfigService(); | 125 static ProxyConfigService* CreateSystemProxyConfigService( |
| 126 MessageLoop* io_loop); |
| 118 | 127 |
| 119 // Creates a proxy resolver appropriate for this platform that doesn't rely | 128 // Creates a proxy resolver appropriate for this platform that doesn't rely |
| 120 // on V8. | 129 // on V8. |
| 121 static ProxyResolver* CreateNonV8ProxyResolver(); | 130 static ProxyResolver* CreateNonV8ProxyResolver(); |
| 122 | 131 |
| 123 ProxyResolver* resolver() { return resolver_.get(); } | 132 ProxyResolver* resolver() { return resolver_.get(); } |
| 124 base::Thread* pac_thread() { return pac_thread_.get(); } | 133 base::Thread* pac_thread() { return pac_thread_.get(); } |
| 125 | 134 |
| 126 // Identifies the proxy configuration. | 135 // Identifies the proxy configuration. |
| 127 ProxyConfig::ID config_id() const { return config_.id(); } | 136 ProxyConfig::ID config_id() const { return config_.id(); } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 265 |
| 257 base::WaitableEvent event_; | 266 base::WaitableEvent event_; |
| 258 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; | 267 CompletionCallbackImpl<SyncProxyServiceHelper> callback_; |
| 259 ProxyInfo proxy_info_; | 268 ProxyInfo proxy_info_; |
| 260 int result_; | 269 int result_; |
| 261 }; | 270 }; |
| 262 | 271 |
| 263 } // namespace net | 272 } // namespace net |
| 264 | 273 |
| 265 #endif // NET_PROXY_PROXY_SERVICE_H_ | 274 #endif // NET_PROXY_PROXY_SERVICE_H_ |
| OLD | NEW |