| 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..b017f9d48bc4acf5c296e0307e0a6b46cabef144 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_) &&
|
| + !is_password_previewed_)
|
| return;
|
|
|
| - ClearPreviewedFormWithElement(element_, was_query_node_autofilled_);
|
| + if(is_password_previewed_) {
|
| + ClearPreviewedFormWithElement(
|
| + element_,
|
| + REQUIRE_NONE,
|
| + was_query_node_autofilled_,
|
| + password_autofill_agent_->WasPasswordAutofilled());
|
| + } 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
|
| @@ -473,6 +486,15 @@ void AutofillAgent::OnAcceptPasswordAutofillSuggestion(
|
| DCHECK(handled);
|
| }
|
|
|
| +void AutofillAgent::OnPreviewPassword(const base::string16& username) {
|
| + was_query_node_autofilled_ = element_.isAutofilled();
|
| + bool handled = password_autofill_agent_->DidSelectAutofillSuggestion(
|
| + element_,
|
| + username);
|
| + is_password_previewed_ = handled;
|
| + DCHECK(handled);
|
| +}
|
| +
|
| void AutofillAgent::OnRequestAutocompleteResult(
|
| WebFormElement::AutocompleteResult result,
|
| const FormData& form_data) {
|
|
|