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..573de904e1a82b70e0addbd28be9c54915a52fc0 100644 |
--- a/chrome/browser/autofill/autofill_external_delegate.cc |
+++ b/chrome/browser/autofill/autofill_external_delegate.cc |
@@ -24,15 +24,22 @@ 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), |
suggestions_clear_index_(-1), |
- suggestions_options_index_(-1) { |
+ suggestions_options_index_(-1), |
+ renderer_hiding_popup_(false) { |
} |
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) |
@@ -46,6 +53,14 @@ void AutofillExternalDelegate::OnQuery(int query_id, |
const webkit::forms::FormField& field, |
const gfx::Rect& bounds, |
bool display_warning_if_disabled) { |
+ if (!renderer_hiding_popup_) { |
csharp
2012/03/08 16:48:37
I tried to send this message in the constructor, b
Ilya Sherman
2012/03/08 23:22:14
Hmm, I don't think I like having this message diss
csharp
2012/03/09 16:20:19
I hadn't thought about adding it there. I've set i
|
+ renderer_hiding_popup_ = true; |
+ |
+ RenderViewHost* host = |
+ tab_contents_wrapper_->web_contents()->GetRenderViewHost(); |
+ host->Send(new AutofillMsg_DisableRendererPopup(host->GetRoutingID())); |
+ } |
+ |
autofill_query_form_ = form; |
autofill_query_field_ = field; |
display_warning_if_disabled_ = display_warning_if_disabled; |
@@ -148,9 +163,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_)) { |
@@ -177,6 +196,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())); |
@@ -189,6 +212,17 @@ void AutofillExternalDelegate::HideAutofillPopup() { |
HideAutofillPopupInternal(); |
} |
+void AutofillExternalDelegate::FrameClosing(int frame_id) { |
Ilya Sherman
2012/03/08 23:22:14
nit: int -> long long?
csharp
2012/03/09 16:20:19
Removed
|
+ password_autofill_manager_.FrameClosing(frame_id); |
+} |
+ |
+void AutofillExternalDelegate::FillPasswordForm( |
+ const webkit::forms::FormField& form, |
+ const webkit::forms::PasswordFormFillData& fill_data, |
+ int frame_id) { |
Ilya Sherman
2012/03/08 23:22:14
nit: int -> long long?
csharp
2012/03/09 16:20:19
Removed
|
+ password_autofill_manager_.FillPasswordForm(form, fill_data, frame_id); |
+} |
+ |
void AutofillExternalDelegate::FillAutofillFormData(int unique_id, |
bool is_preview) { |
RenderViewHost* host = |