OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/autofill/core/browser/autofill_manager.h" | 5 #include "components/autofill/core/browser/autofill_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 #include <map> | 10 #include <map> |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
562 iter != result.fields.end(); ++iter) { | 562 iter != result.fields.end(); ++iter) { |
563 if ((*iter) == field) { | 563 if ((*iter) == field) { |
564 base::string16 value = data_model->GetInfoForVariant( | 564 base::string16 value = data_model->GetInfoForVariant( |
565 autofill_field->Type(), variant, app_locale_); | 565 autofill_field->Type(), variant, app_locale_); |
566 if (AutofillField::FillFormField( | 566 if (AutofillField::FillFormField( |
567 *autofill_field, value, app_locale_, &(*iter))) { | 567 *autofill_field, value, app_locale_, &(*iter))) { |
568 // Mark the cached field as autofilled, so that we can detect when a | 568 // Mark the cached field as autofilled, so that we can detect when a |
569 // user edits an autofilled field (for metrics). | 569 // user edits an autofilled field (for metrics). |
570 autofill_field->is_autofilled = true; | 570 autofill_field->is_autofilled = true; |
571 | 571 |
572 // Mark the field as autofilled when a non-empty value is assigned to | |
573 // it. This allows the renderer to distinguish autofilled fields from | |
574 // fields with non-empty values, such as select-one fields. | |
575 int index = iter - result.fields.begin(); | |
576 result.fields[index].is_autofilled = true; | |
Ilya Sherman
2014/06/27 05:59:08
Why do you need an index? Can you just write this
| |
577 | |
572 if (!is_credit_card && !value.empty()) | 578 if (!is_credit_card && !value.empty()) |
573 client_->DidFillOrPreviewField(value, profile_full_name); | 579 client_->DidFillOrPreviewField(value, profile_full_name); |
574 } | 580 } |
575 break; | 581 break; |
576 } | 582 } |
577 } | 583 } |
578 | 584 |
579 driver_->SendFormDataToRenderer(query_id, action, result); | 585 driver_->SendFormDataToRenderer(query_id, action, result); |
580 return; | 586 return; |
581 } | 587 } |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1206 return false; | 1212 return false; |
1207 | 1213 |
1208 // Disregard forms that we wouldn't ever autofill in the first place. | 1214 // Disregard forms that we wouldn't ever autofill in the first place. |
1209 if (!form.ShouldBeParsed(true)) | 1215 if (!form.ShouldBeParsed(true)) |
1210 return false; | 1216 return false; |
1211 | 1217 |
1212 return true; | 1218 return true; |
1213 } | 1219 } |
1214 | 1220 |
1215 } // namespace autofill | 1221 } // namespace autofill |
OLD | NEW |