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 0afa89f767abf38132e3fb9dc7c65342ef6e12f7..48f90519ab0893debd3a6e1592dbeb3060f3f8a7 100644 |
--- a/chrome/browser/autofill/autofill_external_delegate.cc |
+++ b/chrome/browser/autofill/autofill_external_delegate.cc |
@@ -22,6 +22,7 @@ AutofillExternalDelegate::AutofillExternalDelegate( |
AutofillManager* autofill_manager) |
: tab_contents_wrapper_(tab_contents_wrapper), |
autofill_manager_(autofill_manager), |
+ password_autofill_manager_(tab_contents_wrapper), |
autofill_query_id_(0), |
display_warning_if_disabled_(false), |
has_shown_autofill_popup_for_current_edit_(false), |
@@ -31,6 +32,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) |
@@ -146,9 +151,13 @@ void AutofillExternalDelegate::DidAcceptAutofillSuggestions( |
if (unique_id < 0) |
return; |
- // TODO(csharp): Add the password autofill manager. |
- // if (password_autofill_manager_->DidAcceptAutofillSuggestion(node, value)) |
- // return; |
+ if (password_autofill_manager_.DidAcceptAutofillSuggestion( |
+ autofill_query_field_, value)) { |
+ // Accepting has been handled by the password manager. Just make sure |
+ // to hide the popup. |
+ HideAutofillPopup(); |
+ return; |
+ } |
if (suggestions_options_index_ != -1 && |
index == static_cast<unsigned>(suggestions_options_index_)) { |
@@ -175,6 +184,10 @@ void AutofillExternalDelegate::DidAcceptAutofillSuggestions( |
} |
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())); |
@@ -187,6 +200,17 @@ void AutofillExternalDelegate::HideAutofillPopup() { |
HideAutofillPopupInternal(); |
} |
+void AutofillExternalDelegate::FrameClosing(int frame_id) { |
+ password_autofill_manager_.FrameClosing(frame_id); |
+} |
+ |
+void AutofillExternalDelegate::FillPasswordForm( |
+ const webkit::forms::FormField& form, |
+ const webkit::forms::PasswordFormFillData& fill_data, |
+ int frame_id) { |
+ password_autofill_manager_.FillPasswordForm(form, fill_data, frame_id); |
+} |
+ |
void AutofillExternalDelegate::FillAutofillFormData(int unique_id, |
bool is_preview) { |
RenderViewHost* host = |