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 |
150 // We put the following restriction on stored FormFields: | 154 // We put the following restriction on stored FormFields: |
151 // - non-empty name | 155 // - non-empty name |
152 // - non-empty value | 156 // - non-empty value |
153 // - text field | 157 // - text field |
154 // - value is not a credit card number | 158 // - value is not a credit card number |
155 // - value is not a SSN | 159 // - value is not a SSN |
156 std::vector<webkit_glue::FormField> values; | 160 std::vector<webkit_glue::FormField> values; |
157 for (std::vector<webkit_glue::FormField>::const_iterator iter = | 161 for (std::vector<webkit_glue::FormField>::const_iterator iter = |
158 form.fields.begin(); | 162 form.fields.begin(); |
159 iter != form.fields.end(); ++iter) { | 163 iter != form.fields.end(); ++iter) { |
(...skipping 18 matching lines...) Expand all Loading... |
178 DCHECK(result->GetType() == AUTOFILL_VALUE_RESULT); | 182 DCHECK(result->GetType() == AUTOFILL_VALUE_RESULT); |
179 const WDResult<std::vector<string16> >* autofill_result = | 183 const WDResult<std::vector<string16> >* autofill_result = |
180 static_cast<const WDResult<std::vector<string16> >*>(result); | 184 static_cast<const WDResult<std::vector<string16> >*>(result); |
181 host->AutocompleteSuggestionsReturned( | 185 host->AutocompleteSuggestionsReturned( |
182 query_id_, autofill_result->GetValue()); | 186 query_id_, autofill_result->GetValue()); |
183 } else { | 187 } else { |
184 host->AutocompleteSuggestionsReturned( | 188 host->AutocompleteSuggestionsReturned( |
185 query_id_, std::vector<string16>()); | 189 query_id_, std::vector<string16>()); |
186 } | 190 } |
187 } | 191 } |
OLD | NEW |