Chromium Code Reviews| Index: chrome/browser/autofill/autofill_popup_view.cc |
| diff --git a/chrome/browser/autofill/autofill_popup_view.cc b/chrome/browser/autofill/autofill_popup_view.cc |
| index bd285536c4892a7319660ee230d81e875f2358c6..fc7e3d1d0cd3575938d94b4e5bd6daf7672feda8 100644 |
| --- a/chrome/browser/autofill/autofill_popup_view.cc |
| +++ b/chrome/browser/autofill/autofill_popup_view.cc |
| @@ -4,13 +4,19 @@ |
| #include "chrome/browser/autofill/autofill_popup_view.h" |
| +#include "base/logging.h" |
| +#include "chrome/browser/autofill/autofill_external_delegate.h" |
| #include "content/public/browser/web_contents.h" |
| #include "content/public/browser/navigation_controller.h" |
| #include "content/public/browser/notification_service.h" |
| #include "content/public/browser/notification_source.h" |
| #include "content/public/browser/notification_types.h" |
| -AutofillPopupView::AutofillPopupView(content::WebContents* web_contents) { |
| +AutofillPopupView::AutofillPopupView( |
| + content::WebContents* web_contents, |
| + AutofillExternalDelegate* external_delegate) |
| + : external_delegate_(external_delegate), |
| + selected_line_(-1) { |
| registrar_.Add(this, |
| content::NOTIFICATION_WEB_CONTENTS_HIDDEN, |
| content::Source<content::WebContents>(web_contents)); |
| @@ -23,6 +29,12 @@ AutofillPopupView::AutofillPopupView(content::WebContents* web_contents) { |
| AutofillPopupView::~AutofillPopupView() {} |
| +void AutofillPopupView::Hide() { |
| + HideInternal(); |
| + |
| + external_delegate_->ClearPreviewedForm(); |
| +} |
| + |
| void AutofillPopupView::Show(const std::vector<string16>& autofill_values, |
| const std::vector<string16>& autofill_labels, |
| const std::vector<string16>& autofill_icons, |
| @@ -38,6 +50,24 @@ void AutofillPopupView::Show(const std::vector<string16>& autofill_values, |
| ShowInternal(); |
| } |
| +void AutofillPopupView::SetSelectedLine(int selected_line) { |
| + if (selected_line_ == selected_line) |
| + return; |
| + |
| + if (selected_line_ != -1) |
| + InvalidateRow(selected_line_); |
| + |
| + if (selected_line != -1) |
| + InvalidateRow(selected_line); |
| + |
| + selected_line_ = selected_line; |
| + |
| + if (selected_line_ != -1) |
|
Ilya Sherman
2012/02/07 23:35:55
nit: Please add curly braces, since the body of th
csharp
2012/02/08 16:11:16
Done.
|
| + external_delegate_->SelectAutofillSuggestionAtIndex( |
| + autofill_unique_ids_[selected_line_], |
| + selected_line); |
| +} |
| + |
| void AutofillPopupView::Observe(int type, |
| const content::NotificationSource& source, |
| const content::NotificationDetails& details) { |