| Index: chrome/browser/autofill/autofill_external_delegate.cc
|
| diff --git a/chrome/browser/autofill/autofill_external_delegate.cc b/chrome/browser/autofill/autofill_external_delegate.cc
|
| index 4105709df4993045f92069ceaa3933924acb55fc..10285fbe95c3d95a305574f090a556ef34df38c3 100644
|
| --- a/chrome/browser/autofill/autofill_external_delegate.cc
|
| +++ b/chrome/browser/autofill/autofill_external_delegate.cc
|
| @@ -24,6 +24,8 @@ AutofillExternalDelegate::AutofillExternalDelegate(
|
| AutofillManager* autofill_manager)
|
| : tab_contents_wrapper_(tab_contents_wrapper),
|
| autofill_manager_(autofill_manager),
|
| + password_autofill_manager_(
|
| + tab_contents_wrapper->web_contents()->GetRenderViewHost()),
|
| autofill_query_id_(0),
|
| display_warning_if_disabled_(false),
|
| has_shown_autofill_popup_for_current_edit_(false),
|
| @@ -33,6 +35,10 @@ AutofillExternalDelegate::AutofillExternalDelegate(
|
|
|
| void AutofillExternalDelegate::SelectAutofillSuggestionAtIndex(int unique_id,
|
| int list_index) {
|
| + if (password_autofill_manager_.DidSelectAutofillSuggestion(
|
| + autofill_query_field_))
|
| + return;
|
| +
|
| if (list_index == suggestions_options_index_ ||
|
| list_index == suggestions_clear_index_ ||
|
| unique_id == -1)
|
| @@ -148,9 +154,13 @@ void AutofillExternalDelegate::DidAcceptAutofillSuggestions(
|
| if (unique_id < 0)
|
| return;
|
|
|
| - // TODO(csharp): Add the password autofill manager.
|
| - // if (password_autofill_manager_->DidAcceptAutofillSuggestion(node, value))
|
| - // return;
|
| + HideAutofillPopup();
|
| +
|
| + if (password_autofill_manager_.DidAcceptAutofillSuggestion(
|
| + autofill_query_field_, value)) {
|
| + // Accepting has been handled by the password manager.
|
| + return;
|
| + }
|
|
|
| if (suggestions_options_index_ != -1 &&
|
| index == static_cast<unsigned>(suggestions_options_index_)) {
|
| @@ -172,11 +182,13 @@ void AutofillExternalDelegate::DidAcceptAutofillSuggestions(
|
| } else {
|
| FillAutofillFormData(unique_id, false);
|
| }
|
| -
|
| - HideAutofillPopup();
|
| }
|
|
|
| void AutofillExternalDelegate::ClearPreviewedForm() {
|
| + if (password_autofill_manager_.DidClearAutofillSelection(
|
| + autofill_query_field_))
|
| + return;
|
| +
|
| RenderViewHost* host =
|
| tab_contents_wrapper_->web_contents()->GetRenderViewHost();
|
| host->Send(new AutofillMsg_ClearPreviewedForm(host->GetRoutingID()));
|
| @@ -189,6 +201,18 @@ void AutofillExternalDelegate::HideAutofillPopup() {
|
| HideAutofillPopupInternal();
|
| }
|
|
|
| +void AutofillExternalDelegate::Reset() {
|
| + HideAutofillPopup();
|
| +
|
| + password_autofill_manager_.Reset();
|
| +}
|
| +
|
| +void AutofillExternalDelegate::AddPasswordFormMapping(
|
| + const webkit::forms::FormField& form,
|
| + const webkit::forms::PasswordFormFillData& fill_data) {
|
| + password_autofill_manager_.AddPasswordFormMapping(form, fill_data);
|
| +}
|
| +
|
| void AutofillExternalDelegate::FillAutofillFormData(int unique_id,
|
| bool is_preview) {
|
| RenderViewHost* host =
|
|
|