summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Android.mk1
-rw-r--r--android/jni/autofill_request_url.cc22
-rw-r--r--android/jni/autofill_request_url.h22
-rw-r--r--chrome/browser/autofill/autofill_download.cc14
4 files changed, 59 insertions, 0 deletions
diff --git a/Android.mk b/Android.mk
index c598799..5f272aa 100644
--- a/Android.mk
+++ b/Android.mk
@@ -33,6 +33,7 @@ LOCAL_SRC_FILES := \
googleurl/src/url_util.cc \
\
android/execinfo.cc \
+ android/jni/autofill_request_url.cc \
android/jni/mime_utils.cc \
android/jni/jni_utils.cc \
android/jni/platform_file_jni.cc \
diff --git a/android/jni/autofill_request_url.cc b/android/jni/autofill_request_url.cc
new file mode 100644
index 0000000..e272798
--- /dev/null
+++ b/android/jni/autofill_request_url.cc
@@ -0,0 +1,22 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "android/jni/autofill_request_url.h"
+#include "android/jni/jni_utils.h"
+
+namespace android {
+
+std::string AutofillRequestUrl::GetQueryUrl() {
+ JNIEnv* env = android::GetJNIEnv();
+ jclass bridgeClass = env->FindClass("android/webkit/JniUtil");
+ jmethodID method = env->GetStaticMethodID(bridgeClass, "getAutofillQueryUrl", "()Ljava/lang/String;");
+ jstring autofill_query_url = static_cast<jstring>(env->CallStaticObjectMethod(bridgeClass, method));
+ std::string request_url = android::JstringToStdString(env, autofill_query_url);
+ env->DeleteLocalRef(autofill_query_url);
+ env->DeleteLocalRef(bridgeClass);
+
+ return request_url;
+}
+
+} // namespace android
diff --git a/android/jni/autofill_request_url.h b/android/jni/autofill_request_url.h
new file mode 100644
index 0000000..56cc4b2
--- /dev/null
+++ b/android/jni/autofill_request_url.h
@@ -0,0 +1,22 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef ANDROID_JNI_AUTOFILLREQUESTURL_H
+#define ANDROID_JNI_AUTOFILLREQUESTURL_H
+
+#include "base/basictypes.h"
+#include <string>
+
+namespace android {
+
+class AutofillRequestUrl {
+ public:
+ static std::string GetQueryUrl();
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(AutofillRequestUrl);
+};
+
+} // namespace android
+
+#endif
diff --git a/chrome/browser/autofill/autofill_download.cc b/chrome/browser/autofill/autofill_download.cc
index 6130b04..295aef0 100644
--- a/chrome/browser/autofill/autofill_download.cc
+++ b/chrome/browser/autofill/autofill_download.cc
@@ -8,6 +8,9 @@
#include <ostream>
#include <vector>
+#ifdef ANDROID
+#include "android/jni/autofill_request_url.h"
+#endif
#include "base/logging.h"
#include "base/rand_util.h"
#include "base/stl_util-inl.h"
@@ -214,6 +217,17 @@ bool AutofillDownloadManager::StartRequest(
else
request_url = AUTO_FILL_UPLOAD_SERVER_REQUEST_URL;
+#ifdef ANDROID
+ if (request_data.request_type == AutofillDownloadManager::REQUEST_QUERY) {
+ // Ask the platform what URL to use for Autofill. If the
+ // platform doesn't know, bail and rely on the heuristics
+ // we've gathered.
+ request_url = android::AutofillRequestUrl::GetQueryUrl();
+ if (request_url.empty())
+ return false;
+ }
+#endif
+
// 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_++,