| 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..7e3ba5a3be0d87fca605378dd1c5b1d6857fa3ad 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,25 @@ 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) {
|
| + external_delegate_->SelectAutofillSuggestionAtIndex(
|
| + autofill_unique_ids_[selected_line_],
|
| + selected_line);
|
| + }
|
| +}
|
| +
|
| void AutofillPopupView::Observe(int type,
|
| const content::NotificationSource& source,
|
| const content::NotificationDetails& details) {
|
|
|