Index: android_webview/native/form_database.cc |
diff --git a/android_webview/native/form_database.cc b/android_webview/native/form_database.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4f5eb8d9f761299dd41b5b27fba0c159c2e13bea |
--- /dev/null |
+++ b/android_webview/native/form_database.cc |
@@ -0,0 +1,39 @@ |
+// Copyright 2013 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_webview/native/form_database.h" |
+ |
+#include "android_webview/browser/aw_browser_context.h" |
+#include "android_webview/browser/aw_content_browser_client.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/FormDatabase_jni.h" |
+ |
+namespace android_webview { |
+ |
+// static |
+void ClearFormData(JNIEnv*, jclass) { |
+ AwBrowserContext* context = AwContentBrowserClient::GetAwBrowserContext(); |
+ DCHECK(context); |
+ |
+ autofill::AutofillWebDataService* service = |
+ autofill::AutofillWebDataService::FromBrowserContext(context).get(); |
+ if (service == NULL) { |
+ LOG(WARNING) << "No webdata service found, ignoring ClearFormData"; |
+ return; |
+ } |
+ |
+ base::Time begin; |
benm (inactive)
2013/04/23 18:07:47
mm, what's the behavior of getting "the null time"
sgurun-gerrit only
2013/04/23 20:49:45
it is ok. This is also how it is used in the brows
|
+ base::Time end = base::Time::Max(); |
+ service->RemoveFormElementsAddedBetween(begin, end); |
+ service->RemoveAutofillDataModifiedBetween(begin, end); |
+} |
+ |
+bool RegisterFormDatabase(JNIEnv* env) { |
+ return RegisterNativesImpl(env) >= 0; |
+} |
+ |
+} // namespace android_webview |