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

Unified Diff: android_webview/native/form_database.cc

Issue 13902021: Implement clearFormData for WebViewDatabase (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: make FormDatabase (java side) non static. 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/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

Powered by Google App Engine
This is Rietveld 408576698