From 318e34c3d8491b948069c206713b17c6a15ec73a Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Tue, 26 Oct 2010 13:32:48 +0100 Subject: 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 --- WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp') 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 -- cgit v1.1