Chromium Code Reviews| Index: chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc |
| =================================================================== |
| --- chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc (revision 81359) |
| +++ chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc (working copy) |
| @@ -266,7 +266,14 @@ |
| } |
| void AutocompletePopupContentsView::InvalidateLine(size_t line) { |
| - GetChildViewAt(static_cast<int>(line))->SchedulePaint(); |
| + if (line < model_->result().size()) { |
| + AutocompleteResultView* result_view = |
| + static_cast<AutocompleteResultView*>(GetChildViewAt( |
| + static_cast<int>(line))); |
| + |
| + result_view->SetMatch(GetMatchAtIndex(line)); |
| + result_view->SchedulePaint(); |
| + } |
| } |
| void AutocompletePopupContentsView::UpdatePopupAppearance() { |
| @@ -301,7 +308,7 @@ |
| result_view = static_cast<AutocompleteResultView*>(GetChildViewAt(i)); |
| result_view->SetVisible(true); |
| } |
| - result_view->set_match(GetMatchAtIndex(i)); |
| + result_view->SetMatch(GetMatchAtIndex(i)); |
| } |
| for (size_t i = model_->result().size(); i < child_rv_count; ++i) |
| GetChildViewAt(i)->SetVisible(false); |
| @@ -623,11 +630,13 @@ |
| // OpenURL() may close the popup, which will clear the result set and, by |
| // extension, |match| and its contents. So copy the relevant strings out to |
| // make sure they stay alive until the call completes. |
| + string16 keyword; |
| + if (match.has_keyword_hint()) |
| + keyword.assign(match.keyword); |
|
Peter Kasting
2011/04/13 21:06:59
Nit: Eliminate the temp and do this with a ?: insi
|
| + |
| const GURL url(match.destination_url); |
| - string16 keyword; |
| - const bool is_keyword_hint = model_->GetKeywordForMatch(match, &keyword); |
| edit_view_->OpenURL(url, disposition, match.transition, GURL(), index, |
| - is_keyword_hint ? string16() : keyword); |
| + keyword); |
| } |
| size_t AutocompletePopupContentsView::GetIndexForPoint( |