diff options
author | ahutter@chromium.org <ahutter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-11 19:45:12 +0000 |
---|---|---|
committer | ahutter@chromium.org <ahutter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-11 19:45:12 +0000 |
commit | f3b42ccfb51e178c3902c7c3ddb2680303c38138 (patch) | |
tree | 915dad3403d10fa521bf7a95ffb9441705f6dfcf /chrome/android/java | |
parent | 68cf7561f60d5e39343298db66231d7fb2811bf5 (diff) | |
download | chromium_src-f3b42ccfb51e178c3902c7c3ddb2680303c38138.zip chromium_src-f3b42ccfb51e178c3902c7c3ddb2680303c38138.tar.gz chromium_src-f3b42ccfb51e178c3902c7c3ddb2680303c38138.tar.bz2 |
Using form field errors from Wallet server.
The Wallet server identifies validation errors when the client tries
to save or update data to it. This utilizes the errors returned and
displays them to the user.
BUG=243853
Review URL: https://chromiumcodereview.appspot.com/14585016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205607 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/android/java')
-rw-r--r-- | chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialog.java | 23 | ||||
-rw-r--r-- | chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogGlue.java | 16 |
2 files changed, 22 insertions, 17 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialog.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialog.java index a7c9305..8f0524a 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialog.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialog.java @@ -105,25 +105,29 @@ public class AutofillDialog extends Dialog /** * Informs AutofillDialog controller that the user has edited or activate an EditText field. + * @param section Section that is being edited. Should match one of the values in + * {@link AutofillDialogConstants}. * @param dialogInputPointer The native pointer to the field that was edited or activated. * @param delegate The ViewAndroidDelegate that should be used to attach the AutofillPopup * if the AutofillPopup controller has any suggestions. * @param value The current value the focused field. * @param wasEdit True if it is an edit, otherwise False. */ - public void editedOrActivatedField(int dialogInputPointer, ViewAndroidDelegate delegate, - String value, boolean wasEdit); + public void editedOrActivatedField(int section, int dialogInputPointer, + ViewAndroidDelegate delegate, String value, boolean wasEdit); /** * Requests AutofillDialog controller to validate the specified field. If the field is * invalid the returned value contains the error string. If the field is valid then * the returned value is null. + * @param section Section that is being edited. Should match one of the values in + * {@link AutofillDialogConstants}. * @param fieldType The type of the field that is being edited. Should match one of the * values in {@link AutofillDialogConstants}. * @param value The value of the field that is being edited. * @return The error if the field is not valid, otherwise return null. */ - public String validateField(int fieldType, String value); + public String validateField(int section, int fieldType, String value); /** * Requests AutofillDialog controller to validate the specified section. @@ -754,8 +758,9 @@ public class AutofillDialog extends Dialog @Override public void afterTextChanged(Editable editable) { - mDelegate.editedOrActivatedField(mFocusedFieldNativePointer, - AutofillDialog.this, editable.toString(), true); + mDelegate.editedOrActivatedField(mView.getCurrentSection(), + mFocusedFieldNativePointer, AutofillDialog.this, editable.toString(), + true); } }; } @@ -798,14 +803,14 @@ public class AutofillDialog extends Dialog // Add text watcher to the currently selected EditText and send out the first // editedOrActivated call because text watcher only sends it out after text changes. addTextWatcher(currentfield, nativePointer); - mDelegate.editedOrActivatedField(mFocusedFieldNativePointer, this, - mFocusedField.getText().toString(), false); + mDelegate.editedOrActivatedField(mView.getCurrentSection(), mFocusedFieldNativePointer, + this, mFocusedField.getText().toString(), false); } else { // Remove text watcher for the EditText that is being defocused, then validate that // field. Entire section is validated if the field is valid. currentfield.removeTextChangedListener(mCurrentTextWatcher); - String errorText = - mDelegate.validateField(fieldType, currentfield.getText().toString()); + String errorText = mDelegate.validateField(mView.getCurrentSection(), fieldType, + currentfield.getText().toString()); currentfield.setError(errorText); if (errorText == null) mDelegate.validateSection(section); } diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogGlue.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogGlue.java index 373355d..9a4dda4 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogGlue.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillDialogGlue.java @@ -214,15 +214,15 @@ public class AutofillDialogGlue implements AutofillDialogDelegate, } @Override - public void editedOrActivatedField(int dialogInputPointer, ViewAndroidDelegate delegate, - String value, boolean wasEdit) { - nativeEditedOrActivatedField(mNativeDialogPopup, dialogInputPointer, + public void editedOrActivatedField(int section, int dialogInputPointer, + ViewAndroidDelegate delegate, String value, boolean wasEdit) { + nativeEditedOrActivatedField(mNativeDialogPopup, section, dialogInputPointer, mViewAndroid.getNativePointer(), value, wasEdit); } @Override - public String validateField(int fieldType, String value) { - return nativeValidateField(mNativeDialogPopup, fieldType, value); + public String validateField(int section, int fieldType, String value) { + return nativeValidateField(mNativeDialogPopup, section, fieldType, value); } @Override @@ -421,9 +421,9 @@ public class AutofillDialogGlue implements AutofillDialogDelegate, private native boolean nativeEditingComplete(int nativeAutofillDialogViewAndroid, int section); private native void nativeEditingCancel(int nativeAutofillDialogViewAndroid, int section); private native void nativeEditedOrActivatedField(int nativeAutofillDialogViewAndroid, - int dialogInputPointer, int viewAndroid, String value, boolean wasEdit); - private native String nativeValidateField(int nativeAutofillDialogViewAndroid, int fieldType, - String value); + int section, int dialogInputPointer, int viewAndroid, String value, boolean wasEdit); + private native String nativeValidateField(int nativeAutofillDialogViewAndroid, int section, + int fieldType, String value); private native void nativeValidateSection(int nativeAutofillDialogViewAndroid, int section); private native void nativeDialogSubmit(int nativeAutofillDialogViewAndroid); private native void nativeDialogCancel(int nativeAutofillDialogViewAndroid); |