summaryrefslogtreecommitdiffstats
path: root/chrome/common
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-09-23 17:49:04 +0100
committerSteve Block <steveblock@google.com>2010-09-27 12:52:34 +0100
commit6662b631f1f14f6db83e053e0dd7887bb18adb91 (patch)
treef6425f763904a94f4e10649d3a1390ed9abf3dd7 /chrome/common
parent7d214dfa174224b459660971e5b5cce2e06be02a (diff)
downloadexternal_chromium-6662b631f1f14f6db83e053e0dd7887bb18adb91.zip
external_chromium-6662b631f1f14f6db83e053e0dd7887bb18adb91.tar.gz
external_chromium-6662b631f1f14f6db83e053e0dd7887bb18adb91.tar.bz2
Refactor URLFetcherProxy to minimise the Android-specific diff
URLFetcherProxy now extends URLFetcher to minimise the diff in code that uses this class. Change-Id: Id5abdfb82f334cf36f01f178ac300d64f0017e9f
Diffstat (limited to 'chrome/common')
-rw-r--r--chrome/common/net/url_fetcher.cc9
-rw-r--r--chrome/common/net/url_fetcher.h22
2 files changed, 27 insertions, 4 deletions
diff --git a/chrome/common/net/url_fetcher.cc b/chrome/common/net/url_fetcher.cc
index a74255b..8f8f6aa 100644
--- a/chrome/common/net/url_fetcher.cc
+++ b/chrome/common/net/url_fetcher.cc
@@ -18,6 +18,10 @@
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_context.h"
+#ifdef ANDROID
+#include "android/autofill/url_fetcher_proxy.h"
+#endif
+
static const int kBufferSize = 4096;
bool URLFetcher::g_interception_enabled = false;
@@ -129,8 +133,13 @@ URLFetcher::~URLFetcher() {
// static
URLFetcher* URLFetcher::Create(int id, const GURL& url,
RequestType request_type, Delegate* d) {
+#ifdef ANDROID
+ // TODO: Upstream.
+ return new URLFetcherProxy(url, request_type, d);
+#else
return factory_ ? factory_->CreateURLFetcher(id, url, request_type, d) :
new URLFetcher(url, request_type, d);
+#endif
}
URLFetcher::Core::Core(URLFetcher* fetcher,
diff --git a/chrome/common/net/url_fetcher.h b/chrome/common/net/url_fetcher.h
index 3b0bafd..7a8fd32 100644
--- a/chrome/common/net/url_fetcher.h
+++ b/chrome/common/net/url_fetcher.h
@@ -74,9 +74,10 @@ class URLFetcher {
const ResponseCookies& cookies,
const std::string& data) = 0;
#ifdef ANDROID
- // TODO: Upstream.
- virtual ~Delegate() { }
+ // TODO: Upstream.
+ virtual
#endif
+ ~Delegate() { }
};
// URLFetcher::Create uses the currently registered Factory to create the
@@ -88,9 +89,10 @@ class URLFetcher {
RequestType request_type,
Delegate* d) = 0;
#ifdef ANDROID
- // TODO: Upstream
- virtual ~Factory() { }
+ // TODO: Upstream
+ virtual
#endif
+ ~Factory() { }
};
// |url| is the URL to send the request to.
@@ -125,6 +127,10 @@ class URLFetcher {
// call this before the request is started. |upload_content_type| is the MIME
// type of the content, while |upload_content| is the data to be sent (the
// Content-Length header value will be set to the length of this data).
+#ifdef ANDROID
+ // TODO: Upstream.
+ virtual
+#endif
void set_upload_data(const std::string& upload_content_type,
const std::string& upload_content);
@@ -141,11 +147,19 @@ class URLFetcher {
// Set the URLRequestContext on the request. Must be called before the
// request is started.
+#ifdef ANDROID
+ // TODO: Upstream.
+ virtual
+#endif
void set_request_context(URLRequestContextGetter* request_context_getter);
// If |retry| is false, 5xx responses will be propagated to the observer,
// if it is true URLFetcher will automatically re-execute the request,
// after backoff_delay() elapses. URLFetcher has it set to true by default.
+#ifdef ANDROID
+ // TODO: Upstream.
+ virtual
+#endif
void set_automatcally_retry_on_5xx(bool retry);
// Returns the back-off delay before the request will be retried,