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

Unified Diff: android_webview/native/aw_form_database.cc

Issue 13902021: Implement clearFormData for WebViewDatabase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: modify DEPS 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
« no previous file with comments | « android_webview/native/aw_form_database.h ('k') | android_webview/native/webview_native.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100644
index 0000000000000000000000000000000000000000..f0d42fdc7cafb8cccb1118cd9082e66643c38415
--- /dev/null
+++ b/android_webview/native/aw_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/aw_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/AwFormDatabase_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;
+ 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
« no previous file with comments | « android_webview/native/aw_form_database.h ('k') | android_webview/native/webview_native.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698