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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
549 bool should_notify = | 549 bool should_notify = |
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; |
Ilya Sherman
2014/06/03 20:39:31
nit: Please leave a blank line after this one.
| |
560 // Mark the field as autofilled when a non-empty value is assigned to | |
561 // it. | |
Ilya Sherman
2014/06/03 20:39:31
nit: Please extend this comment with "This allows
| |
562 result.fields[i].is_autofilled = true; | |
560 | 563 |
561 if (should_notify) | 564 if (should_notify) |
562 manager_delegate_->DidFillOrPreviewField(value, profile_full_name); | 565 manager_delegate_->DidFillOrPreviewField(value, profile_full_name); |
563 } | 566 } |
564 } | 567 } |
565 } | 568 } |
566 | 569 |
567 autofilled_form_signatures_.push_front(form_structure->FormSignature()); | 570 autofilled_form_signatures_.push_front(form_structure->FormSignature()); |
568 // Only remember the last few forms that we've seen, both to avoid false | 571 // Only remember the last few forms that we've seen, both to avoid false |
569 // positives and to avoid wasting memory. | 572 // positives and to avoid wasting memory. |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1138 return false; | 1141 return false; |
1139 | 1142 |
1140 // Disregard forms that we wouldn't ever autofill in the first place. | 1143 // Disregard forms that we wouldn't ever autofill in the first place. |
1141 if (!form.ShouldBeParsed(true)) | 1144 if (!form.ShouldBeParsed(true)) |
1142 return false; | 1145 return false; |
1143 | 1146 |
1144 return true; | 1147 return true; |
1145 } | 1148 } |
1146 | 1149 |
1147 } // namespace autofill | 1150 } // namespace autofill |
OLD | NEW |