| 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/autocomplete_history_manager.h" | 5 #include "components/autofill/core/browser/autocomplete_history_manager.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/profiler/scoped_profile.h" | 10 #include "base/profiler/scoped_profile.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 return; | 119 return; |
| 120 | 120 |
| 121 // Don't save data that was submitted through JavaScript. | 121 // Don't save data that was submitted through JavaScript. |
| 122 if (!form.user_submitted) | 122 if (!form.user_submitted) |
| 123 return; | 123 return; |
| 124 | 124 |
| 125 // We put the following restriction on stored FormFields: | 125 // We put the following restriction on stored FormFields: |
| 126 // - non-empty name | 126 // - non-empty name |
| 127 // - non-empty value | 127 // - non-empty value |
| 128 // - text field | 128 // - text field |
| 129 // - autocomplete is not disabled |
| 129 // - value is not a credit card number | 130 // - value is not a credit card number |
| 130 // - value is not a SSN | 131 // - value is not a SSN |
| 131 std::vector<FormFieldData> values; | 132 std::vector<FormFieldData> values; |
| 132 for (std::vector<FormFieldData>::const_iterator iter = | 133 for (std::vector<FormFieldData>::const_iterator iter = |
| 133 form.fields.begin(); | 134 form.fields.begin(); |
| 134 iter != form.fields.end(); ++iter) { | 135 iter != form.fields.end(); ++iter) { |
| 135 if (!iter->value.empty() && | 136 if (!iter->value.empty() && |
| 136 !iter->name.empty() && | 137 !iter->name.empty() && |
| 137 IsTextField(*iter) && | 138 IsTextField(*iter) && |
| 139 iter->should_autocomplete && |
| 138 !autofill::IsValidCreditCardNumber(iter->value) && | 140 !autofill::IsValidCreditCardNumber(iter->value) && |
| 139 !autofill::IsSSN(iter->value)) { | 141 !autofill::IsSSN(iter->value)) { |
| 140 values.push_back(*iter); | 142 values.push_back(*iter); |
| 141 } | 143 } |
| 142 } | 144 } |
| 143 | 145 |
| 144 if (!values.empty() && database_.get()) | 146 if (!values.empty() && database_.get()) |
| 145 database_->AddFormFields(values); | 147 database_->AddFormFields(values); |
| 146 } | 148 } |
| 147 | 149 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 autofill_unique_ids_); | 196 autofill_unique_ids_); |
| 195 | 197 |
| 196 query_id_ = 0; | 198 query_id_ = 0; |
| 197 autofill_values_.clear(); | 199 autofill_values_.clear(); |
| 198 autofill_labels_.clear(); | 200 autofill_labels_.clear(); |
| 199 autofill_icons_.clear(); | 201 autofill_icons_.clear(); |
| 200 autofill_unique_ids_.clear(); | 202 autofill_unique_ids_.clear(); |
| 201 } | 203 } |
| 202 | 204 |
| 203 } // namespace autofill | 205 } // namespace autofill |
| OLD | NEW |