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/autofill_external_delegate.h" | 5 #include "components/autofill/core/browser/autofill_external_delegate.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "components/autofill/core/browser/autocomplete_history_manager.h" | 8 #include "components/autofill/core/browser/autocomplete_history_manager.h" |
9 #include "components/autofill/core/browser/autofill_driver.h" | 9 #include "components/autofill/core/browser/autofill_driver.h" |
10 #include "components/autofill/core/browser/autofill_manager.h" | 10 #include "components/autofill/core/browser/autofill_manager.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } | 155 } |
156 | 156 |
157 void AutofillExternalDelegate::OnPopupHidden() { | 157 void AutofillExternalDelegate::OnPopupHidden() { |
158 } | 158 } |
159 | 159 |
160 bool AutofillExternalDelegate::ShouldRepostEvent(const ui::MouseEvent& event) { | 160 bool AutofillExternalDelegate::ShouldRepostEvent(const ui::MouseEvent& event) { |
161 NOTREACHED(); | 161 NOTREACHED(); |
162 return true; | 162 return true; |
163 } | 163 } |
164 | 164 |
165 void AutofillExternalDelegate::DidSelectSuggestion(int identifier) { | 165 void AutofillExternalDelegate::DidSelectSuggestion( |
| 166 const base::string16& value, |
| 167 int identifier) { |
166 ClearPreviewedForm(); | 168 ClearPreviewedForm(); |
167 | 169 |
168 // Only preview the data if it is a profile. | 170 // Only preview the data if it is a profile. |
169 if (identifier > 0) | 171 if (identifier > 0) |
170 FillAutofillFormData(identifier, true); | 172 FillAutofillFormData(identifier, true); |
| 173 else if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) |
| 174 driver_->RendererShouldPreviewFieldWithValue(value); |
171 } | 175 } |
172 | 176 |
173 void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value, | 177 void AutofillExternalDelegate::DidAcceptSuggestion(const base::string16& value, |
174 int identifier) { | 178 int identifier) { |
175 if (identifier == POPUP_ITEM_ID_AUTOFILL_OPTIONS) { | 179 if (identifier == POPUP_ITEM_ID_AUTOFILL_OPTIONS) { |
176 // User selected 'Autofill Options'. | 180 // User selected 'Autofill Options'. |
177 manager_->ShowAutofillSettings(); | 181 manager_->ShowAutofillSettings(); |
178 } else if (identifier == POPUP_ITEM_ID_CLEAR_FORM) { | 182 } else if (identifier == POPUP_ITEM_ID_CLEAR_FORM) { |
179 // User selected 'Clear form'. | 183 // User selected 'Clear form'. |
180 driver_->RendererShouldClearFilledForm(); | 184 driver_->RendererShouldClearFilledForm(); |
181 } else if (identifier == POPUP_ITEM_ID_PASSWORD_ENTRY) { | 185 } else if (identifier == POPUP_ITEM_ID_PASSWORD_ENTRY) { |
182 bool success = password_manager_.DidAcceptAutofillSuggestion( | 186 bool success = password_manager_.DidAcceptAutofillSuggestion( |
183 query_field_, value); | 187 query_field_, value); |
184 DCHECK(success); | 188 DCHECK(success); |
185 } else if (identifier == POPUP_ITEM_ID_DATALIST_ENTRY) { | 189 } else if (identifier == POPUP_ITEM_ID_DATALIST_ENTRY) { |
186 driver_->RendererShouldAcceptDataListSuggestion(value); | 190 driver_->RendererShouldAcceptDataListSuggestion(value); |
187 } else if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) { | 191 } else if (identifier == POPUP_ITEM_ID_AUTOCOMPLETE_ENTRY) { |
188 // User selected an Autocomplete, so we fill directly. | 192 // User selected an Autocomplete, so we fill directly. |
189 driver_->RendererShouldSetNodeText(value); | 193 driver_->RendererShouldFillFieldWithValue(value); |
190 } else { | 194 } else { |
191 FillAutofillFormData(identifier, false); | 195 FillAutofillFormData(identifier, false); |
192 } | 196 } |
193 | 197 |
194 manager_->delegate()->HideAutofillPopup(); | 198 manager_->delegate()->HideAutofillPopup(); |
195 } | 199 } |
196 | 200 |
197 void AutofillExternalDelegate::RemoveSuggestion(const base::string16& value, | 201 void AutofillExternalDelegate::RemoveSuggestion(const base::string16& value, |
198 int identifier) { | 202 int identifier) { |
199 if (identifier > 0) | 203 if (identifier > 0) |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 // Set the values that all datalist elements share. | 344 // Set the values that all datalist elements share. |
341 icons->insert(icons->begin(), | 345 icons->insert(icons->begin(), |
342 data_list_values_.size(), | 346 data_list_values_.size(), |
343 base::string16()); | 347 base::string16()); |
344 unique_ids->insert(unique_ids->begin(), | 348 unique_ids->insert(unique_ids->begin(), |
345 data_list_values_.size(), | 349 data_list_values_.size(), |
346 POPUP_ITEM_ID_DATALIST_ENTRY); | 350 POPUP_ITEM_ID_DATALIST_ENTRY); |
347 } | 351 } |
348 | 352 |
349 } // namespace autofill | 353 } // namespace autofill |
OLD | NEW |