| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 } | 143 } |
| 144 | 144 |
| 145 void AutocompleteHistoryManager::StoreFormEntriesInWebDatabase( | 145 void AutocompleteHistoryManager::StoreFormEntriesInWebDatabase( |
| 146 const FormData& form) { | 146 const FormData& form) { |
| 147 if (!*autofill_enabled_) | 147 if (!*autofill_enabled_) |
| 148 return; | 148 return; |
| 149 | 149 |
| 150 if (profile_->IsOffTheRecord()) | 150 if (profile_->IsOffTheRecord()) |
| 151 return; | 151 return; |
| 152 | 152 |
| 153 // Don't save data that was submitted through JavaScript. |
| 154 if (!form.user_submitted) |
| 155 return; |
| 156 |
| 153 // We put the following restriction on stored FormFields: | 157 // We put the following restriction on stored FormFields: |
| 154 // - non-empty name | 158 // - non-empty name |
| 155 // - non-empty value | 159 // - non-empty value |
| 156 // - text field | 160 // - text field |
| 157 // - value is not a credit card number | 161 // - value is not a credit card number |
| 158 // - value is not a SSN | 162 // - value is not a SSN |
| 159 std::vector<webkit_glue::FormField> values; | 163 std::vector<webkit_glue::FormField> values; |
| 160 for (std::vector<webkit_glue::FormField>::const_iterator iter = | 164 for (std::vector<webkit_glue::FormField>::const_iterator iter = |
| 161 form.fields.begin(); | 165 form.fields.begin(); |
| 162 iter != form.fields.end(); ++iter) { | 166 iter != form.fields.end(); ++iter) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 181 DCHECK(result->GetType() == AUTOFILL_VALUE_RESULT); | 185 DCHECK(result->GetType() == AUTOFILL_VALUE_RESULT); |
| 182 const WDResult<std::vector<string16> >* autofill_result = | 186 const WDResult<std::vector<string16> >* autofill_result = |
| 183 static_cast<const WDResult<std::vector<string16> >*>(result); | 187 static_cast<const WDResult<std::vector<string16> >*>(result); |
| 184 host->AutocompleteSuggestionsReturned( | 188 host->AutocompleteSuggestionsReturned( |
| 185 query_id_, autofill_result->GetValue()); | 189 query_id_, autofill_result->GetValue()); |
| 186 } else { | 190 } else { |
| 187 host->AutocompleteSuggestionsReturned( | 191 host->AutocompleteSuggestionsReturned( |
| 188 query_id_, std::vector<string16>()); | 192 query_id_, std::vector<string16>()); |
| 189 } | 193 } |
| 190 } | 194 } |
| OLD | NEW |