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