summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autofill/autofill_download.cc
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-08-06 12:08:59 +0100
committerBen Murdoch <benm@google.com>2010-09-13 15:04:09 +0100
commit7d214dfa174224b459660971e5b5cce2e06be02a (patch)
tree8bf36887488cddf26cb43e0394ba35972b5cfefa /chrome/browser/autofill/autofill_download.cc
parentf74420b3285b9fe04a7e00aa3b8c0ab07ea344bc (diff)
downloadexternal_chromium-7d214dfa174224b459660971e5b5cce2e06be02a.zip
external_chromium-7d214dfa174224b459660971e5b5cce2e06be02a.tar.gz
external_chromium-7d214dfa174224b459660971e5b5cce2e06be02a.tar.bz2
Intial set of changes to enable autofill on Android.
This is the initial checkin of AutoFill code into external/chromium. There's still lots to do, but this basically gets autofill working end to end, using a precanned profile injected from WebCore. By default, autofill is not enabled at the moment. For testing you can turn it on by setting the ENABLE_AUTOFILL environment variable to "true" and rebuilding. There is a corresponding change in external/webkit. Change-Id: I74ef1ccc3fd0625f1bb8e2f85b43a60d23c59ffc
Diffstat (limited to 'chrome/browser/autofill/autofill_download.cc')
-rw-r--r--chrome/browser/autofill/autofill_download.cc25
1 files changed, 23 insertions, 2 deletions
diff --git a/chrome/browser/autofill/autofill_download.cc b/chrome/browser/autofill/autofill_download.cc
index eacf477..79a42be 100644
--- a/chrome/browser/autofill/autofill_download.cc
+++ b/chrome/browser/autofill/autofill_download.cc
@@ -15,9 +15,13 @@
#include "chrome/common/pref_names.h"
#include "net/http/http_response_headers.h"
+#ifdef ANDROID
+#include "android/autofill/url_fetcher_proxy.h"
+#endif
+
#define DISABLED_REQUEST_URL "http://disabled"
-#if defined(GOOGLE_CHROME_BUILD)
+#if defined(GOOGLE_CHROME_BUILD) || (defined(ANDROID) && defined(HAVE_AUTOFILL_DOWNLOAD_INTERNAL_H) && HAVE_AUTOFILL_DOWNLOAD_INTERNAL_H)
#include "chrome/browser/autofill/internal/autofill_download_internal.h"
#else
#define AUTO_FILL_QUERY_SERVER_REQUEST_URL DISABLED_REQUEST_URL
@@ -109,7 +113,11 @@ bool AutoFillDownloadManager::StartUploadRequest(
bool AutoFillDownloadManager::CancelRequest(
const std::string& form_signature,
AutoFillDownloadManager::AutoFillRequestType request_type) {
+#ifdef ANDROID
+ for (std::map<URLFetcherProxy *, FormRequestData>::iterator it =
+#else
for (std::map<URLFetcher *, FormRequestData>::iterator it =
+#endif
url_fetchers_.begin();
it != url_fetchers_.end();
++it) {
@@ -168,7 +176,10 @@ bool AutoFillDownloadManager::StartRequest(
// We have it disabled - return true as if it succeeded, but do nothing.
return true;
}
-
+#ifdef ANDROID
+ URLFetcherProxy *fetcher = new URLFetcherProxy(GURL(request_url), this, form_xml);
+ url_fetchers_[fetcher] = request_data;
+#else
// Id is ignored for regular chrome, in unit test id's for fake fetcher
// factory will be 0, 1, 2, ...
URLFetcher *fetcher = URLFetcher::Create(fetcher_id_for_unittest_++,
@@ -180,17 +191,27 @@ bool AutoFillDownloadManager::StartRequest(
fetcher->set_request_context(Profile::GetDefaultRequestContext());
fetcher->set_upload_data("text/plain", form_xml);
fetcher->Start();
+#endif
return true;
}
+#ifdef ANDROID
+void AutoFillDownloadManager::OnURLFetchComplete(const URLFetcherProxy* source,
+#else
void AutoFillDownloadManager::OnURLFetchComplete(const URLFetcher* source,
+#endif
const GURL& url,
const URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data) {
+#ifdef ANDROID
+ std::map<URLFetcherProxy *, FormRequestData>::iterator it =
+ url_fetchers_.find(const_cast<URLFetcherProxy*>(source));
+#else
std::map<URLFetcher *, FormRequestData>::iterator it =
url_fetchers_.find(const_cast<URLFetcher*>(source));
+#endif
if (it == url_fetchers_.end()) {
// Looks like crash on Mac is possibly caused with callback entering here
// with unknown fetcher when network is refreshed.