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 iter->is_autofilled = true; |
| 576 |
572 if (!is_credit_card && !value.empty()) | 577 if (!is_credit_card && !value.empty()) |
573 client_->DidFillOrPreviewField(value, profile_full_name); | 578 client_->DidFillOrPreviewField(value, profile_full_name); |
574 } | 579 } |
575 break; | 580 break; |
576 } | 581 } |
577 } | 582 } |
578 | 583 |
579 driver_->SendFormDataToRenderer(query_id, action, result); | 584 driver_->SendFormDataToRenderer(query_id, action, result); |
580 return; | 585 return; |
581 } | 586 } |
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1206 return false; | 1211 return false; |
1207 | 1212 |
1208 // Disregard forms that we wouldn't ever autofill in the first place. | 1213 // Disregard forms that we wouldn't ever autofill in the first place. |
1209 if (!form.ShouldBeParsed(true)) | 1214 if (!form.ShouldBeParsed(true)) |
1210 return false; | 1215 return false; |
1211 | 1216 |
1212 return true; | 1217 return true; |
1213 } | 1218 } |
1214 | 1219 |
1215 } // namespace autofill | 1220 } // namespace autofill |
OLD | NEW |