Index: components/autofill/content/renderer/autofill_agent.cc |
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc |
index 5f3b03043eb0d6793db7fb47026ea428a26ab0ec..0a261f5c4b5d27e2804e9a78394ee30c16f0fcb6 100644 |
--- a/components/autofill/content/renderer/autofill_agent.cc |
+++ b/components/autofill/content/renderer/autofill_agent.cc |
@@ -157,6 +157,7 @@ bool AutofillAgent::OnMessageReceived(const IPC::Message& message) { |
OnAcceptDataListSuggestion) |
IPC_MESSAGE_HANDLER(AutofillMsg_AcceptPasswordAutofillSuggestion, |
OnAcceptPasswordAutofillSuggestion) |
+ IPC_MESSAGE_HANDLER(AutofillMsg_PreviewPassword, OnPreviewPassword) |
IPC_MESSAGE_HANDLER(AutofillMsg_RequestAutocompleteResult, |
OnRequestAutocompleteResult) |
IPC_MESSAGE_UNHANDLED(handled = false) |
@@ -436,10 +437,22 @@ void AutofillAgent::OnClearForm() { |
void AutofillAgent::OnClearPreviewedForm() { |
if (!element_.isNull()) { |
- if (password_autofill_agent_->DidClearAutofillSelection(element_)) |
+ if (password_autofill_agent_->DidClearAutofillSelection(element_) && |
+ !password_autofill_agent_->IsPasswordPreviewed()) |
return; |
- ClearPreviewedFormWithElement(element_, was_query_node_autofilled_); |
+ if(password_autofill_agent_->IsPasswordPreviewed()) { |
+ ClearPreviewedFormWithElement( |
+ element_, |
+ REQUIRE_NONE, |
+ was_query_node_autofilled_, |
+ password_autofill_agent_->WasPasswordAutofilled()); |
Ilya Sherman
2014/03/25 19:45:27
Please move all of the password-related logic for
|
+ } else { |
+ ClearPreviewedFormWithElement(element_, |
+ REQUIRE_AUTOCOMPLETE, |
+ was_query_node_autofilled_, |
+ false); |
+ } |
} else { |
// TODO(isherman): There seem to be rare cases where this code *is* |
// reachable: see [ http://crbug.com/96321#c6 ]. Ideally we would |
@@ -467,7 +480,15 @@ void AutofillAgent::OnAcceptPasswordAutofillSuggestion( |
// We need to make sure this is handled here because the browser process |
// skipped it handling because it believed it would be handled here. If it |
// isn't handled here then the browser logic needs to be updated. |
- bool handled = password_autofill_agent_->DidAcceptAutofillSuggestion( |
+ bool handled = password_autofill_agent_->DidAcceptSuggestion( |
+ element_, |
+ username); |
+ DCHECK(handled); |
+} |
+ |
+void AutofillAgent::OnPreviewPassword(const base::string16& username) { |
+ was_query_node_autofilled_ = element_.isAutofilled(); |
+ bool handled = password_autofill_agent_->DidSelectSuggestion( |
element_, |
username); |
DCHECK(handled); |