summaryrefslogtreecommitdiffstats
path: root/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2010-10-26 13:32:48 +0100
committerBen Murdoch <benm@google.com>2010-10-29 10:30:40 +0100
commit318e34c3d8491b948069c206713b17c6a15ec73a (patch)
tree7e00130ec23128e5e78ee00dd28115632f5bfcbe /WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp
parent87a1254a18452cdb5ed7453e37ae38388bcaec2b (diff)
downloadexternal_webkit-318e34c3d8491b948069c206713b17c6a15ec73a.zip
external_webkit-318e34c3d8491b948069c206713b17c6a15ec73a.tar.gz
external_webkit-318e34c3d8491b948069c206713b17c6a15ec73a.tar.bz2
Clear chromium side autofill profiles when java syncs a null profile.
This implements the native code needed to support the deletion of a profile through the editor UI. Change-Id: I7966551324d709612bff7cafeaf8a2cf93c218f0
Diffstat (limited to 'WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp')
-rw-r--r--WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp b/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp
index ef9d598..1aecef1 100644
--- a/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp
+++ b/WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp
@@ -44,6 +44,7 @@
#include "WebUrlLoaderClient.h"
#include "WebViewCore.h"
+#define NO_PROFILE_SET 0
#define FORM_NOT_AUTOFILLABLE -1
namespace android
@@ -56,6 +57,7 @@ static URLRequestContext* webAutoFillContextGetter()
WebAutoFill::WebAutoFill()
: mWebViewCore(0)
+ , mUniqueProfileId(NO_PROFILE_SET)
{
mFormManager = new FormManager();
mQueryId = 1;
@@ -172,6 +174,7 @@ void WebAutoFill::setProfile(int id, const string16& fullName, const string16& e
const string16& state, const string16& zipCode, const string16& country, const string16& phoneNumber)
{
AutoFillProfile autoFillProfile;
+ mUniqueProfileId = id;
autoFillProfile.set_unique_id(id);
// Constants for AutoFill field types are found in external/chromium/chrome/browser/autofill/field_types.h.
@@ -191,6 +194,17 @@ void WebAutoFill::setProfile(int id, const string16& fullName, const string16& e
mTabContents->profile()->GetPersonalDataManager()->SetProfiles(&profiles);
}
+void WebAutoFill::clearProfiles()
+{
+ // For now Chromium only ever knows about one profile, so we can just
+ // remove it by unique id. If we support multiple profiles in the future
+ // we need to remove them all here.
+ if (mUniqueProfileId != NO_PROFILE_SET) {
+ mTabContents->profile()->GetPersonalDataManager()->RemoveProfile(mUniqueProfileId);
+ mUniqueProfileId = NO_PROFILE_SET;
+ }
+}
+
}
#endif