[Password Manager] Fix incorrect saving when autofill and generation both trigger
commit5c13d76a088a244b93b3d05c76d0709d2d5a0be7
authorgcasto <gcasto@chromium.org>
Wed, 3 Jun 2015 23:44:45 +0000 (3 16:44 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 3 Jun 2015 23:45:50 +0000 (3 23:45 +0000)
treee993f15423700e1b6970b370c236c214345c795b
parent8a004c32881f48be88ee499531ea91d91189f0c3
[Password Manager] Fix incorrect saving when autofill and generation both trigger

If the password manager fills a field and generation triggers for the same field,
currently we will not correctly update the password that is entered in the field.
This means that if the user enters a different password than was autofilled, the
new saved password will be incorrect.

There are two specific changes here:
- Update PasswordAutofillAgent's state when text changes regardless of if it is
  allowed to show a popup.
- Specifically inform PasswordAutofillAgent when a generated password is accepted
  as this text change is dropped as it looks like script updating the page.

Eventually we should not autofill into fields that generation triggers on, since
we don't want to fill old data into a signup form. That change is more involved
thought.

TBR=sky@chromium.org
BUG=493455

Review URL: https://codereview.chromium.org/1154153004

Cr-Commit-Position: refs/heads/master@{#332733}
14 files changed:
chrome/chrome_tests.gypi
chrome/renderer/autofill/password_autofill_agent_browsertest.cc
chrome/renderer/autofill/password_generation_agent_browsertest.cc
chrome/renderer/autofill/password_generation_test_utils.cc [new file with mode: 0644]
chrome/renderer/autofill/password_generation_test_utils.h [new file with mode: 0644]
chrome/renderer/chrome_content_renderer_client.cc
chrome/test/base/chrome_render_view_test.cc
components/autofill/content/renderer/autofill_agent.cc
components/autofill/content/renderer/password_autofill_agent.cc
components/autofill/content/renderer/password_autofill_agent.h
components/autofill/content/renderer/password_generation_agent.cc
components/autofill/content/renderer/password_generation_agent.h
components/autofill/content/renderer/test_password_generation_agent.cc
components/autofill/content/renderer/test_password_generation_agent.h