Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Side by Side Diff: components/autofill/core/browser/autocomplete_history_manager.cc

Issue 204343004: Add supports that allow Autofill to be initiated from textarea field (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update code as per Ilya's review comments Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 if (!manager_delegate_->IsAutocompleteEnabled() ||
97 form_control_type == "textarea") {
96 SendSuggestions(NULL); 98 SendSuggestions(NULL);
97 return; 99 return;
98 } 100 }
99 101
100 if (database_.get()) { 102 if (database_.get()) {
101 pending_query_handle_ = database_->GetFormValuesForElementName( 103 pending_query_handle_ = database_->GetFormValuesForElementName(
102 name, prefix, kMaxAutocompleteMenuItems, this); 104 name, prefix, kMaxAutocompleteMenuItems, this);
103 } 105 }
104 } 106 }
105 107
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 autofill_unique_ids_); 188 autofill_unique_ids_);
187 189
188 query_id_ = 0; 190 query_id_ = 0;
189 autofill_values_.clear(); 191 autofill_values_.clear();
190 autofill_labels_.clear(); 192 autofill_labels_.clear();
191 autofill_icons_.clear(); 193 autofill_icons_.clear();
192 autofill_unique_ids_.clear(); 194 autofill_unique_ids_.clear();
193 } 195 }
194 196
195 } // namespace autofill 197 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698