Chromium Code Reviews| Index: chrome/browser/ui/autofill/autofill_popup_controller_impl.cc |
| diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc |
| index e7cc9dd6b46a241a090f50647f025f7c66854df6..d4d3d99b94cbce95d21d715b35e3a16b5fcbf678 100644 |
| --- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc |
| +++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc |
| @@ -446,10 +446,17 @@ void AutofillPopupControllerImpl::SetSelectedLine(int selected_line) { |
| selected_line_ = selected_line; |
| - if (selected_line_ != kNoSelection) |
| - delegate_->DidSelectSuggestion(identifiers_[selected_line_]); |
| - else |
| + if (selected_line_ != kNoSelection) { |
| + if ((identifiers_[selected_line_] == |
| + WebAutofillClient::MenuItemIDAutocompleteEntry) && |
| + (selected_line_ < static_cast<int>(names_.size()))) |
|
Ilya Sherman
2014/02/14 02:22:28
nit: No need for the extra parens around the compo
Ilya Sherman
2014/02/14 02:22:28
Why do you need the second check? When can select
|
| + delegate_->DidSelectAutocompleteSuggestion(names_[selected_line_]); |
|
Ilya Sherman
2014/02/14 02:22:28
Rather than introducing a new method, it seems rea
|
| + else |
| + delegate_->DidSelectSuggestion(identifiers_[selected_line_]); |
| + } else { |
| delegate_->ClearPreviewedForm(); |
| + delegate_->ClearAutocompletePreviewedField(); |
|
Ilya Sherman
2014/02/14 02:22:28
Why can't ClearPreviewedForm() just handle clearin
|
| + } |
| } |
| void AutofillPopupControllerImpl::SelectNextLine() { |
| @@ -520,6 +527,7 @@ bool AutofillPopupControllerImpl::RemoveSelectedLine() { |
| if (HasSuggestions()) { |
| delegate_->ClearPreviewedForm(); |
| + delegate_->ClearAutocompletePreviewedField(); |
| UpdateBoundsAndRedrawPopup(); |
| } else { |
| Hide(); |