OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/autofill/core/browser/autocomplete_history_manager.h" | 5 #include "components/autofill/core/browser/autocomplete_history_manager.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 const WDResult<std::vector<base::string16> >* autofill_result = | 74 const WDResult<std::vector<base::string16> >* autofill_result = |
75 static_cast<const WDResult<std::vector<base::string16> >*>(result); | 75 static_cast<const WDResult<std::vector<base::string16> >*>(result); |
76 std::vector<base::string16> suggestions = autofill_result->GetValue(); | 76 std::vector<base::string16> suggestions = autofill_result->GetValue(); |
77 SendSuggestions(&suggestions); | 77 SendSuggestions(&suggestions); |
78 } | 78 } |
79 | 79 |
80 void AutocompleteHistoryManager::OnGetAutocompleteSuggestions( | 80 void AutocompleteHistoryManager::OnGetAutocompleteSuggestions( |
81 int query_id, | 81 int query_id, |
82 const base::string16& name, | 82 const base::string16& name, |
83 const base::string16& prefix, | 83 const base::string16& prefix, |
84 const std::string form_control_type, | |
84 const std::vector<base::string16>& autofill_values, | 85 const std::vector<base::string16>& autofill_values, |
85 const std::vector<base::string16>& autofill_labels, | 86 const std::vector<base::string16>& autofill_labels, |
86 const std::vector<base::string16>& autofill_icons, | 87 const std::vector<base::string16>& autofill_icons, |
87 const std::vector<int>& autofill_unique_ids) { | 88 const std::vector<int>& autofill_unique_ids) { |
88 CancelPendingQuery(); | 89 CancelPendingQuery(); |
89 | 90 |
90 query_id_ = query_id; | 91 query_id_ = query_id; |
91 autofill_values_ = autofill_values; | 92 autofill_values_ = autofill_values; |
92 autofill_labels_ = autofill_labels; | 93 autofill_labels_ = autofill_labels; |
93 autofill_icons_ = autofill_icons; | 94 autofill_icons_ = autofill_icons; |
94 autofill_unique_ids_ = autofill_unique_ids; | 95 autofill_unique_ids_ = autofill_unique_ids; |
95 if (!manager_delegate_->IsAutocompleteEnabled()) { | 96 // Don't return autocomplete suggestions for textarea. |
Ilya Sherman
2014/03/19 23:47:42
nit: This comment is redundant with the code; plea
ziran.sun
2014/03/20 19:03:41
Done.
| |
97 if (!manager_delegate_->IsAutocompleteEnabled() || | |
98 form_control_type == "textarea") { | |
96 SendSuggestions(NULL); | 99 SendSuggestions(NULL); |
97 return; | 100 return; |
98 } | 101 } |
99 | 102 |
100 if (database_.get()) { | 103 if (database_.get()) { |
101 pending_query_handle_ = database_->GetFormValuesForElementName( | 104 pending_query_handle_ = database_->GetFormValuesForElementName( |
102 name, prefix, kMaxAutocompleteMenuItems, this); | 105 name, prefix, kMaxAutocompleteMenuItems, this); |
103 } | 106 } |
104 } | 107 } |
105 | 108 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
186 autofill_unique_ids_); | 189 autofill_unique_ids_); |
187 | 190 |
188 query_id_ = 0; | 191 query_id_ = 0; |
189 autofill_values_.clear(); | 192 autofill_values_.clear(); |
190 autofill_labels_.clear(); | 193 autofill_labels_.clear(); |
191 autofill_icons_.clear(); | 194 autofill_icons_.clear(); |
192 autofill_unique_ids_.clear(); | 195 autofill_unique_ids_.clear(); |
193 } | 196 } |
194 | 197 |
195 } // namespace autofill | 198 } // namespace autofill |
OLD | NEW |