Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(622)

Unified Diff: android_webview/native/aw_form_database.cc

Issue 14503010: Implement WebViewDatabase's hasFormData API for chromium based webview. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typos Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/native/aw_form_database.cc
diff --git a/android_webview/native/aw_form_database.cc b/android_webview/native/aw_form_database.cc
index f0d42fdc7cafb8cccb1118cd9082e66643c38415..37cd52c533c47e96fc3e8db56c0cd4f4701f94ed 100644
--- a/android_webview/native/aw_form_database.cc
+++ b/android_webview/native/aw_form_database.cc
@@ -6,19 +6,40 @@
#include "android_webview/browser/aw_browser_context.h"
#include "android_webview/browser/aw_content_browser_client.h"
+#include "android_webview/browser/aw_form_database_service.h"
#include "base/android/jni_android.h"
#include "base/logging.h"
#include "base/time.h"
#include "components/autofill/browser/webdata/autofill_webdata_service.h"
#include "jni/AwFormDatabase_jni.h"
+// static
benm (inactive) 2013/04/29 18:00:03 anonymous namespace?
sgurun-gerrit only 2013/04/29 19:32:39 this def is for autofill namespace. On 2013/04/29
+scoped_refptr<autofill::AutofillWebDataService>
+autofill::AutofillWebDataService::FromBrowserContext(
+ content::BrowserContext* context) {
+
+ DCHECK(context);
+ android_webview::AwFormDatabaseService* service =
+ static_cast<android_webview::AwBrowserContext*>(
+ context)->GetFormDatabaseService();
+ DCHECK(service);
+ return service->get_autofill_webdata_service();
+}
+
namespace android_webview {
// static
-void ClearFormData(JNIEnv*, jclass) {
+jboolean HasFormData(JNIEnv*, jclass) {
AwBrowserContext* context = AwContentBrowserClient::GetAwBrowserContext();
DCHECK(context);
+ AwFormDatabaseService* service = context->GetFormDatabaseService();
+ DCHECK(service);
+ return service->HasFormElements();
+}
+// static
+void ClearFormData(JNIEnv*, jclass) {
+ AwBrowserContext* context = AwContentBrowserClient::GetAwBrowserContext();
autofill::AutofillWebDataService* service =
autofill::AutofillWebDataService::FromBrowserContext(context).get();
if (service == NULL) {
@@ -32,7 +53,7 @@ void ClearFormData(JNIEnv*, jclass) {
service->RemoveAutofillDataModifiedBetween(begin, end);
}
-bool RegisterFormDatabase(JNIEnv* env) {
+bool RegisterAwFormDatabase(JNIEnv* env) {
return RegisterNativesImpl(env) >= 0;
}

Powered by Google App Engine
This is Rietveld 408576698