| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/autocomplete_history_manager.h" | 5 #include "chrome/browser/autocomplete_history_manager.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // We put the following restriction on stored FormFields: | 112 // We put the following restriction on stored FormFields: |
| 113 // - non-empty name | 113 // - non-empty name |
| 114 // - non-empty value | 114 // - non-empty value |
| 115 // - text field | 115 // - text field |
| 116 // - value is not a credit card number | 116 // - value is not a credit card number |
| 117 // - value is not a SSN | 117 // - value is not a SSN |
| 118 std::vector<webkit_glue::FormField> values; | 118 std::vector<webkit_glue::FormField> values; |
| 119 for (std::vector<webkit_glue::FormField>::const_iterator iter = | 119 for (std::vector<webkit_glue::FormField>::const_iterator iter = |
| 120 form.fields.begin(); | 120 form.fields.begin(); |
| 121 iter != form.fields.end(); ++iter) { | 121 iter != form.fields.end(); ++iter) { |
| 122 if (!iter->value().empty() && | 122 if (!iter->value.empty() && |
| 123 !iter->name().empty() && | 123 !iter->name.empty() && |
| 124 iter->form_control_type() == ASCIIToUTF16("text") && | 124 iter->form_control_type == ASCIIToUTF16("text") && |
| 125 !CreditCard::IsCreditCardNumber(iter->value()) && | 125 !CreditCard::IsCreditCardNumber(iter->value) && |
| 126 !IsSSN(iter->value())) | 126 !IsSSN(iter->value)) |
| 127 values.push_back(*iter); | 127 values.push_back(*iter); |
| 128 } | 128 } |
| 129 | 129 |
| 130 if (!values.empty() && web_data_service_.get()) | 130 if (!values.empty() && web_data_service_.get()) |
| 131 web_data_service_->AddFormFields(values); | 131 web_data_service_->AddFormFields(values); |
| 132 } | 132 } |
| 133 | 133 |
| 134 void AutocompleteHistoryManager::OnRemoveAutocompleteEntry( | 134 void AutocompleteHistoryManager::OnRemoveAutocompleteEntry( |
| 135 const string16& name, const string16& value) { | 135 const string16& name, const string16& value) { |
| 136 if (web_data_service_.get()) | 136 if (web_data_service_.get()) |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 autofill_labels_, | 241 autofill_labels_, |
| 242 autofill_icons_, | 242 autofill_icons_, |
| 243 autofill_unique_ids_)); | 243 autofill_unique_ids_)); |
| 244 | 244 |
| 245 query_id_ = 0; | 245 query_id_ = 0; |
| 246 autofill_values_.clear(); | 246 autofill_values_.clear(); |
| 247 autofill_labels_.clear(); | 247 autofill_labels_.clear(); |
| 248 autofill_icons_.clear(); | 248 autofill_icons_.clear(); |
| 249 autofill_unique_ids_.clear(); | 249 autofill_unique_ids_.clear(); |
| 250 } | 250 } |
| OLD | NEW |