| 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/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "chrome/browser/pref_service.h" | 10 #include "chrome/browser/pref_service.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 std::vector<webkit_glue::FormField> values; | 116 std::vector<webkit_glue::FormField> values; |
| 117 for (std::vector<webkit_glue::FormField>::const_iterator iter = | 117 for (std::vector<webkit_glue::FormField>::const_iterator iter = |
| 118 form.fields.begin(); | 118 form.fields.begin(); |
| 119 iter != form.fields.end(); ++iter) { | 119 iter != form.fields.end(); ++iter) { |
| 120 if (!iter->value().empty() && | 120 if (!iter->value().empty() && |
| 121 !iter->name().empty() && | 121 !iter->name().empty() && |
| 122 iter->form_control_type() == ASCIIToUTF16("text")) | 122 iter->form_control_type() == ASCIIToUTF16("text")) |
| 123 values.push_back(*iter); | 123 values.push_back(*iter); |
| 124 } | 124 } |
| 125 | 125 |
| 126 profile()->GetWebDataService(Profile::EXPLICIT_ACCESS)-> | 126 profile()->GetWebDataService(Profile::EXPLICIT_ACCESS)->AddFormFields(values); |
| 127 AddFormFieldValues(values); | |
| 128 } | 127 } |
| 129 | 128 |
| 130 void AutocompleteHistoryManager::SendSuggestions(const WDTypedResult* result) { | 129 void AutocompleteHistoryManager::SendSuggestions(const WDTypedResult* result) { |
| 131 RenderViewHost* host = tab_contents_->render_view_host(); | 130 RenderViewHost* host = tab_contents_->render_view_host(); |
| 132 if (!host) | 131 if (!host) |
| 133 return; | 132 return; |
| 134 if (result) { | 133 if (result) { |
| 135 DCHECK(result->GetType() == AUTOFILL_VALUE_RESULT); | 134 DCHECK(result->GetType() == AUTOFILL_VALUE_RESULT); |
| 136 const WDResult<std::vector<string16> >* autofill_result = | 135 const WDResult<std::vector<string16> >* autofill_result = |
| 137 static_cast<const WDResult<std::vector<string16> >*>(result); | 136 static_cast<const WDResult<std::vector<string16> >*>(result); |
| 138 host->AutocompleteSuggestionsReturned( | 137 host->AutocompleteSuggestionsReturned( |
| 139 query_id_, autofill_result->GetValue(), -1); | 138 query_id_, autofill_result->GetValue(), -1); |
| 140 } else { | 139 } else { |
| 141 host->AutocompleteSuggestionsReturned( | 140 host->AutocompleteSuggestionsReturned( |
| 142 query_id_, std::vector<string16>(), -1); | 141 query_id_, std::vector<string16>(), -1); |
| 143 } | 142 } |
| 144 } | 143 } |
| OLD | NEW |