diff options
Diffstat (limited to 'WebKit/android/WebCoreSupport')
-rw-r--r-- | WebKit/android/WebCoreSupport/autofill/WebAutoFill.cpp | 14 | ||||
-rw-r--r-- | WebKit/android/WebCoreSupport/autofill/WebAutoFill.h | 4 |
2 files changed, 18 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 diff --git a/WebKit/android/WebCoreSupport/autofill/WebAutoFill.h b/WebKit/android/WebCoreSupport/autofill/WebAutoFill.h index 46850e6..d74c838 100644 --- a/WebKit/android/WebCoreSupport/autofill/WebAutoFill.h +++ b/WebKit/android/WebCoreSupport/autofill/WebAutoFill.h @@ -66,6 +66,7 @@ public: void setProfile(int id, const string16& fullName, const string16& emailAddress, const string16& companyName, const string16& addressLine1, const string16& addressLine2, const string16& city, const string16& state, const string16& zipCode, const string16& country, const string16& phoneNumber); + void clearProfiles(); private: OwnPtr<FormManager> mFormManager; @@ -83,6 +84,9 @@ private: AutoFillQueryToUniqueIdMap mUniqueIdMap; int mQueryId; + // This is set by Java when a profile is synced. + int mUniqueProfileId; + WebViewCore* mWebViewCore; }; |