Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Unified Diff: ios/chrome/browser/autofill/autofill_agent.mm

Issue 2966093002: Iterate over multiple forms.
Patch Set: Fix compilation error. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/chrome/browser/autofill/autofill_agent.mm
diff --git a/ios/chrome/browser/autofill/autofill_agent.mm b/ios/chrome/browser/autofill/autofill_agent.mm
index 1cdc17b4ab9dedc05037cd1e0efb2629e1d8240b..280132ca6cf3cd3f72d54cb8d02708499cec3436 100644
--- a/ios/chrome/browser/autofill/autofill_agent.mm
+++ b/ios/chrome/browser/autofill/autofill_agent.mm
@@ -65,12 +65,14 @@ void GetFormAndField(autofill::FormData* form,
const std::string& fieldName,
const std::string& type) {
DCHECK_GE(forms.size(), 1U);
- *form = forms[0];
const base::string16 fieldName16 = base::UTF8ToUTF16(fieldName);
- for (const auto& currentField : form->fields) {
- if (currentField.name == fieldName16) {
- *field = currentField;
- break;
+ for (const auto& currentForm : forms) {
+ for (const auto& currentField : currentForm.fields) {
+ if (currentField.name == fieldName16) {
+ *form = currentForm;
+ *field = currentField;
+ break;
+ }
}
}
if (field->SameFieldAs(autofill::FormFieldData()))
@@ -538,7 +540,7 @@ void GetFormAndField(autofill::FormData* form,
// AutofillManager for suggestions.
__weak AutofillAgent* weakSelf = self;
id completionHandler = ^(BOOL success, const FormDataVector& forms) {
- if (success && forms.size() == 1) {
+ if (success && forms.size() >= 1) {
[weakSelf queryAutofillWithForms:forms
field:fieldName
type:type
@@ -743,7 +745,7 @@ void GetFormAndField(autofill::FormData* form,
__weak AutofillAgent* weakSelf = self;
id completionHandler = ^(BOOL success, const FormDataVector& forms) {
- if (success && forms.size() == 1) {
+ if (success && forms.size() >= 1) {
[weakSelf processFormActivityExtractedData:forms
fieldName:fieldNameCopy
type:typeCopy
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698