Chromium Code Reviews| Index: http_fetcher.h |
| diff --git a/http_fetcher.h b/http_fetcher.h |
| old mode 100644 |
| new mode 100755 |
| index e4f791a13a18184165e0fe4bdb2d82b04975659c..87f8c496364d64f6f44bb8294cfd26d5085b8290 |
| --- a/http_fetcher.h |
| +++ b/http_fetcher.h |
| @@ -12,6 +12,7 @@ |
| #include <base/basictypes.h> |
| #include <base/logging.h> |
| #include <glib.h> |
| +#include <google/protobuf/stubs/common.h> |
| #include "update_engine/proxy_resolver.h" |
| @@ -36,8 +37,10 @@ class HttpFetcher { |
| http_response_code_(0), |
| delegate_(NULL), |
| proxies_(1, kNoProxy), |
| - proxy_resolver_(proxy_resolver) {} |
| - virtual ~HttpFetcher() {} |
| + proxy_resolver_(proxy_resolver), |
| + no_resolver_idle_id_(0), |
|
petkov
2011/02/14 22:13:50
s/tab/spaces/
adlr
2011/02/16 18:18:22
Sorry, been working w/ some 3rd party/non-google-s
|
| + callback_(NULL) {} |
| + virtual ~HttpFetcher(); |
|
petkov
2011/02/14 22:13:50
s/tab/spaces/
adlr
2011/02/16 18:18:22
Done.
|
| void set_delegate(HttpFetcherDelegate* delegate) { delegate_ = delegate; } |
| HttpFetcherDelegate* delegate() const { return delegate_; } |
| @@ -48,7 +51,9 @@ class HttpFetcher { |
| void SetPostData(const void* data, size_t size); |
| // Proxy methods to set the proxies, then to pop them off. |
| - void ResolveProxiesForUrl(const std::string& url); |
| + // Returns true on success. |
| + bool ResolveProxiesForUrl(const std::string& url, |
| + google::protobuf::Closure* callback); |
| void SetProxies(const std::deque<std::string>& proxies) { |
| proxies_ = proxies; |
| @@ -110,10 +115,23 @@ class HttpFetcher { |
| // Proxy servers |
| std::deque<std::string> proxies_; |
| - |
| + |
| ProxyResolver* const proxy_resolver_; |
| + // The ID of the idle callback, used when we have no proxy resolver. |
|
petkov
2011/02/14 22:13:50
indentation is off
adlr
2011/02/16 18:18:22
Done.
|
| + guint no_resolver_idle_id_; |
| + |
| + // Callback for when we are resolving proxies |
| + google::protobuf::Closure* callback_; |
| + |
| private: |
| + // Callback from the proxy resolver |
| + void ProxiesResolved(const std::deque<std::string>& proxies); |
| + static void StaticProxiesResolved(const std::deque<std::string>& proxies, |
| + void* data) { |
| + reinterpret_cast<HttpFetcher*>(data)->ProxiesResolved(proxies); |
| + } |
| + |
| DISALLOW_COPY_AND_ASSIGN(HttpFetcher); |
| }; |