| 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 487248fba6fdda38fb06cfa215aecb70cb0b4acf..f38c967164246fa24a5760a1d410dc726d503ff9 100644
|
| --- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
|
| +++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
|
| @@ -114,9 +114,9 @@ void AutofillPopupControllerImpl::Show(
|
| #endif
|
|
|
| if (just_created) {
|
| - ShowView();
|
| + view_->Show();
|
| } else {
|
| - UpdateBoundsAndRedrawPopup();
|
| + OnSuggestionsChanged();
|
| }
|
|
|
| controller_common_->RegisterKeyPressCallback();
|
| @@ -153,7 +153,7 @@ void AutofillPopupControllerImpl::UpdateDataListValues(
|
|
|
| // The popup contents have changed, so either update the bounds or hide it.
|
| if (HasSuggestions())
|
| - UpdateBoundsAndRedrawPopup();
|
| + OnSuggestionsChanged();
|
| else
|
| Hide();
|
|
|
| @@ -185,7 +185,7 @@ void AutofillPopupControllerImpl::UpdateDataListValues(
|
| elided_labels_[i] = labels[i];
|
| }
|
|
|
| - UpdateBoundsAndRedrawPopup();
|
| + OnSuggestionsChanged();
|
| DCHECK_EQ(suggestions_.size(), elided_values_.size());
|
| DCHECK_EQ(suggestions_.size(), elided_labels_.size());
|
| }
|
| @@ -245,7 +245,7 @@ bool AutofillPopupControllerImpl::HandleKeyPressEvent(
|
| }
|
| }
|
|
|
| -void AutofillPopupControllerImpl::UpdateBoundsAndRedrawPopup() {
|
| +void AutofillPopupControllerImpl::OnSuggestionsChanged() {
|
| #if !defined(OS_ANDROID)
|
| // TODO(csharp): Since UpdatePopupBounds can change the position of the popup,
|
| // the popup could end up jumping from above the element to below it.
|
| @@ -255,7 +255,7 @@ void AutofillPopupControllerImpl::UpdateBoundsAndRedrawPopup() {
|
| #endif
|
|
|
| // Platform-specific draw call.
|
| - view_->UpdateBoundsAndRedrawPopup();
|
| + view_->OnSuggestionsChanged();
|
| }
|
|
|
| void AutofillPopupControllerImpl::SetSelectionAtPoint(const gfx::Point& point) {
|
| @@ -366,7 +366,7 @@ bool AutofillPopupControllerImpl::RemoveSuggestion(int list_index) {
|
|
|
| if (HasSuggestions()) {
|
| delegate_->ClearPreviewedForm();
|
| - UpdateBoundsAndRedrawPopup();
|
| + OnSuggestionsChanged();
|
| } else {
|
| Hide();
|
| }
|
| @@ -395,13 +395,18 @@ void AutofillPopupControllerImpl::SetSelectedLine(int selected_line) {
|
| return;
|
|
|
| if (selected_line_ != kNoSelection &&
|
| - static_cast<size_t>(selected_line_) < suggestions_.size())
|
| - InvalidateRow(selected_line_);
|
| + static_cast<size_t>(selected_line_) < suggestions_.size()) {
|
| + DCHECK_GE(selected_line_, 0);
|
| + view_->InvalidateRow(selected_line_, false /* is_selected */);
|
| + }
|
|
|
| if (selected_line != kNoSelection) {
|
| - InvalidateRow(selected_line);
|
| + DCHECK_GE(selected_line, 0);
|
| + DCHECK_LT(static_cast<size_t>(selected_line), suggestions_.size());
|
| + const bool is_selected = CanAccept(suggestions_[selected_line].frontend_id);
|
| + view_->InvalidateRow(selected_line, is_selected);
|
|
|
| - if (!CanAccept(suggestions_[selected_line].frontend_id))
|
| + if (!is_selected)
|
| selected_line = kNoSelection;
|
| }
|
|
|
| @@ -482,16 +487,6 @@ void AutofillPopupControllerImpl::SetValues(
|
| }
|
| }
|
|
|
| -void AutofillPopupControllerImpl::ShowView() {
|
| - view_->Show();
|
| -}
|
| -
|
| -void AutofillPopupControllerImpl::InvalidateRow(size_t row) {
|
| - DCHECK(0 <= row);
|
| - DCHECK(row < suggestions_.size());
|
| - view_->InvalidateRow(row);
|
| -}
|
| -
|
| WeakPtr<AutofillPopupControllerImpl> AutofillPopupControllerImpl::GetWeakPtr() {
|
| return weak_ptr_factory_.GetWeakPtr();
|
| }
|
|
|