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 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
550 !is_credit_card && | 550 !is_credit_card && |
551 !value.empty() && | 551 !value.empty() && |
552 (result.fields[i] == field || | 552 (result.fields[i] == field || |
553 result.fields[i].form_control_type == "select-one" || | 553 result.fields[i].form_control_type == "select-one" || |
554 result.fields[i].value.empty()); | 554 result.fields[i].value.empty()); |
555 if (AutofillField::FillFormField( | 555 if (AutofillField::FillFormField( |
556 *cached_field, value, app_locale_, &result.fields[i])) { | 556 *cached_field, value, app_locale_, &result.fields[i])) { |
557 // Mark the cached field as autofilled, so that we can detect when a | 557 // Mark the cached field as autofilled, so that we can detect when a |
558 // user edits an autofilled field (for metrics). | 558 // user edits an autofilled field (for metrics). |
559 form_structure->field(i)->is_autofilled = true; | 559 form_structure->field(i)->is_autofilled = true; |
560 // Mark the "select-one" field as autofilled when a non-empty value is | |
561 // assigned to it. | |
Ilya Sherman
2014/06/02 23:51:00
Is there any harm to doing this for all the autofi
| |
562 if (result.fields[i].form_control_type == "select-one") | |
563 result.fields[i].is_autofilled = true; | |
560 | 564 |
561 if (should_notify) | 565 if (should_notify) |
562 manager_delegate_->DidFillOrPreviewField(value, profile_full_name); | 566 manager_delegate_->DidFillOrPreviewField(value, profile_full_name); |
563 } | 567 } |
564 } | 568 } |
565 } | 569 } |
566 | 570 |
567 autofilled_form_signatures_.push_front(form_structure->FormSignature()); | 571 autofilled_form_signatures_.push_front(form_structure->FormSignature()); |
568 // Only remember the last few forms that we've seen, both to avoid false | 572 // Only remember the last few forms that we've seen, both to avoid false |
569 // positives and to avoid wasting memory. | 573 // positives and to avoid wasting memory. |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1138 return false; | 1142 return false; |
1139 | 1143 |
1140 // Disregard forms that we wouldn't ever autofill in the first place. | 1144 // Disregard forms that we wouldn't ever autofill in the first place. |
1141 if (!form.ShouldBeParsed(true)) | 1145 if (!form.ShouldBeParsed(true)) |
1142 return false; | 1146 return false; |
1143 | 1147 |
1144 return true; | 1148 return true; |
1145 } | 1149 } |
1146 | 1150 |
1147 } // namespace autofill | 1151 } // namespace autofill |
OLD | NEW |