diff options
author | Steve Block <steveblock@google.com> | 2010-09-30 19:00:29 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2010-09-30 20:52:19 +0100 |
commit | 851c24f8cc7438c16c50ead815bde972a60b4a18 (patch) | |
tree | 6adba1a910fedecf646bd8c29495bd016ae604e3 | |
parent | 8a94eb677615af335827cc4723424ebd51502ec1 (diff) | |
download | external_chromium-851c24f8cc7438c16c50ead815bde972a60b4a18.zip external_chromium-851c24f8cc7438c16c50ead815bde972a60b4a18.tar.gz external_chromium-851c24f8cc7438c16c50ead815bde972a60b4a18.tar.bz2 |
Fix a couple of bugs in URLFetcherProxy
We should always use ProfileImplAndroid::GetDefaultRequestContext()
as the request context. Also, we must create the URLFetcher on the
correct thread.
These were introduced in https://android-git.corp.google.com/g/69748
Change-Id: I986e2f7a339e202d62230613f02a8a6c8922f89b
-rw-r--r-- | android/autofill/url_fetcher_proxy.h | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/android/autofill/url_fetcher_proxy.h b/android/autofill/url_fetcher_proxy.h index df47f32..ec548f2 100644 --- a/android/autofill/url_fetcher_proxy.h +++ b/android/autofill/url_fetcher_proxy.h @@ -58,12 +58,13 @@ struct RunnableMethodTraits<class URLFetcherProxy> { // It extends URLFetcher so as to minimise the diff in other code when // using this class in place of URLFetcher. It uses a private // URLFetcher instance to do the network request and thus implements -// URLFetcher::Delegate. +// URLFetcher::Delegate. We always use +// ProfileImplAndroid::GetDefaultRequestContext() as the request +// context. // // Note that we overide the minimum number of methods to allow this // class to be used by AutoFillDownloadManager ... // - set_upload_data() -// - set_request_context() // - set_automatcally_retry_on_5xx() // - Start() class URLFetcherProxy : public URLFetcher, public URLFetcher::Delegate { @@ -72,7 +73,6 @@ public: URLFetcher::RequestType request_type, URLFetcher::Delegate* d) : URLFetcher(url /*unused*/, URLFetcher::POST /*unused*/, d), - real_fetcher_(new URLFetcher(url, request_type, this)), request_type_(request_type), retry_(true) { @@ -87,11 +87,6 @@ public: retry_ = retry; } - virtual void set_request_context(URLRequestContextGetter* request_context_getter) - { - request_context_getter_ = request_context_getter; - } - virtual void set_upload_data(const std::string& upload_content_type, const std::string& upload_content) { @@ -132,10 +127,11 @@ public: private: void DoStart() { + real_fetcher_.reset(new URLFetcher(url(), request_type_, this)); real_fetcher_->set_automatcally_retry_on_5xx(retry_); // We expect set_upload_data() to have been called on this object. real_fetcher_->set_upload_data(upload_content_type_, upload_content_); - real_fetcher_->set_request_context(request_context_getter_); + real_fetcher_->set_request_context(ProfileImplAndroid::GetDefaultRequestContext()); real_fetcher_->Start(); }; @@ -154,7 +150,6 @@ private: URLFetcher::RequestType request_type_; bool retry_; - URLRequestContextGetter* request_context_getter_; std::string upload_content_type_; std::string upload_content_; |