diff options
| author | Ben Murdoch <benm@google.com> | 2010-10-13 16:50:47 +0100 |
|---|---|---|
| committer | Ben Murdoch <benm@google.com> | 2010-10-14 15:42:12 +0100 |
| commit | 04347f699d2341d7cf44105e29dc05a84bef2a1c (patch) | |
| tree | fc4ededae10221ea1a1db050f07740990c8437fd /WebKit/android/jni | |
| parent | a5ffb7c279df240a07658953e1bd5df6d0480cb6 (diff) | |
| download | external_webkit-04347f699d2341d7cf44105e29dc05a84bef2a1c.zip external_webkit-04347f699d2341d7cf44105e29dc05a84bef2a1c.tar.gz external_webkit-04347f699d2341d7cf44105e29dc05a84bef2a1c.tar.bz2 | |
Support the complete AutoFill profile.
Load all AutoFill profile values from Java. Requires a
corresponding change in frameworks/base:
https://android-git.corp.google.com/g/#change,74046
Change-Id: I4567d0879f364647b649c0f3c80ce8e32423b371
Diffstat (limited to 'WebKit/android/jni')
| -rw-r--r-- | WebKit/android/jni/WebSettings.cpp | 47 |
1 files changed, 34 insertions, 13 deletions
diff --git a/WebKit/android/jni/WebSettings.cpp b/WebKit/android/jni/WebSettings.cpp index f75cf9a..5b2fb57 100644 --- a/WebKit/android/jni/WebSettings.cpp +++ b/WebKit/android/jni/WebSettings.cpp @@ -131,6 +131,14 @@ struct FieldIds { jclass autoFillProfileClass = env->FindClass("android/webkit/WebSettings$AutoFillProfile"); mAutoFillProfileFullName = env->GetFieldID(autoFillProfileClass, "mFullName", "Ljava/lang/String;"); mAutoFillProfileEmailAddress = env->GetFieldID(autoFillProfileClass, "mEmailAddress", "Ljava/lang/String;"); + mAutoFillProfileCompanyName = env->GetFieldID(autoFillProfileClass, "mCompanyName", "Ljava/lang/String;"); + mAutoFillProfileAddressLine1 = env->GetFieldID(autoFillProfileClass, "mAddressLine1", "Ljava/lang/String;"); + mAutoFillProfileAddressLine2 = env->GetFieldID(autoFillProfileClass, "mAddressLine2", "Ljava/lang/String;"); + mAutoFillProfileCity = env->GetFieldID(autoFillProfileClass, "mCity", "Ljava/lang/String;"); + mAutoFillProfileState = env->GetFieldID(autoFillProfileClass, "mState", "Ljava/lang/String;"); + mAutoFillProfileZipCode = env->GetFieldID(autoFillProfileClass, "mZipCode", "Ljava/lang/String;"); + mAutoFillProfileCountry = env->GetFieldID(autoFillProfileClass, "mCountry", "Ljava/lang/String;"); + mAutoFillProfilePhoneNumber = env->GetFieldID(autoFillProfileClass, "mPhoneNumber", "Ljava/lang/String;"); #endif LOG_ASSERT(mLayoutAlgorithm, "Could not find field mLayoutAlgorithm"); @@ -243,6 +251,14 @@ struct FieldIds { jfieldID mAutoFillProfile; jfieldID mAutoFillProfileFullName; jfieldID mAutoFillProfileEmailAddress; + jfieldID mAutoFillProfileCompanyName; + jfieldID mAutoFillProfileAddressLine1; + jfieldID mAutoFillProfileAddressLine2; + jfieldID mAutoFillProfileCity; + jfieldID mAutoFillProfileState; + jfieldID mAutoFillProfileZipCode; + jfieldID mAutoFillProfileCountry; + jfieldID mAutoFillProfilePhoneNumber; #endif }; @@ -261,21 +277,26 @@ static void recursiveCleanupForFullLayout(WebCore::RenderObject* obj) } #if ENABLE(WEB_AUTOFILL) -void syncAutoFillProfile(JNIEnv* env, jobject autoFillProfile, WebAutoFill* webAutoFill) +inline string16 getStringFieldAsString16(JNIEnv* env, jobject autoFillProfile, jfieldID fieldId) { - jstring str; - string16 fullName; - string16 emailAddress; - - str = static_cast<jstring>(env->GetObjectField(autoFillProfile, gFieldIds->mAutoFillProfileFullName)); - if (str) - fullName = jstringToString16(env, str); - - str = static_cast<jstring>(env->GetObjectField(autoFillProfile, gFieldIds->mAutoFillProfileEmailAddress)); - if (str) - emailAddress = jstringToString16(env, str); + jstring str = static_cast<jstring>(env->GetObjectField(autoFillProfile, fieldId)); + return str ? jstringToString16(env, str) : string16(); +} - webAutoFill->setProfile(fullName, emailAddress); +void syncAutoFillProfile(JNIEnv* env, jobject autoFillProfile, WebAutoFill* webAutoFill) +{ + string16 fullName = getStringFieldAsString16(env, autoFillProfile, gFieldIds->mAutoFillProfileFullName); + string16 emailAddress = getStringFieldAsString16(env, autoFillProfile, gFieldIds->mAutoFillProfileEmailAddress); + string16 companyName = getStringFieldAsString16(env, autoFillProfile, gFieldIds->mAutoFillProfileCompanyName); + string16 addressLine1 = getStringFieldAsString16(env, autoFillProfile, gFieldIds->mAutoFillProfileAddressLine1); + string16 addressLine2 = getStringFieldAsString16(env, autoFillProfile, gFieldIds->mAutoFillProfileAddressLine2); + string16 city = getStringFieldAsString16(env, autoFillProfile, gFieldIds->mAutoFillProfileCity); + string16 state = getStringFieldAsString16(env, autoFillProfile, gFieldIds->mAutoFillProfileState); + string16 zipCode = getStringFieldAsString16(env, autoFillProfile, gFieldIds->mAutoFillProfileZipCode); + string16 country = getStringFieldAsString16(env, autoFillProfile, gFieldIds->mAutoFillProfileCountry); + string16 phoneNumber = getStringFieldAsString16(env, autoFillProfile, gFieldIds->mAutoFillProfilePhoneNumber); + + webAutoFill->setProfile(fullName, emailAddress, companyName, addressLine1, addressLine2, city, state, zipCode, country, phoneNumber); } #endif |
