PasswordFormManager::DoesManage returns a bitmask
commit467c401bb8a0796144d32343497a692a941f8995
authorvabr@chromium.org <vabr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Thu, 3 Jul 2014 13:44:28 +0000 (3 13:44 +0000)
committervabr@chromium.org <vabr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Thu, 3 Jul 2014 13:44:28 +0000 (3 13:44 +0000)
treece1bb785e13bbcad5a8f3cc55ee8d7fe4a4198bc
parent0630ebff048ef9fd7e6a661669e41eb8c1273898
PasswordFormManager::DoesManage returns a bitmask

Currently, PasswordFormManager::DoesManage returns a Boolean indicating whether the form observed by the manager matches the form passed as an argument. Optionally, one can specify, whether the match should include action URLs or not.

This leads to duplicate calls in PasswordManager::ProvisionallySavePassword (where an exact match is tried first, and then retried without action matching). It could also make calling DoesManage cumbersome if we find out we need more match relaxations (work on handling autocomplete attributes indicates that we might).

This CL changes the signature of DoesManage, so that it returns the scope in which both forms matched as a bitmask. That will solve the duplicate calls (call once, inspect result twice), and will make adding new optional matching parameters easier.

Apart from the refactoring, this CL also fixes two issues:

(1) Previously, |DoesManage(form)| reported that |form| matches |observed_form_| when |form| was not a HTML form, and shared the signon realm with |observed_form_|. In particular, such |form| would match |observed_form_|, even if |observed_form_| was a HTML form.
This CL requires that form schemes are equal for the base match, and adds a test for that.

(2) Previously, the comments said that an empty action URL matches any other action URL, but the code checked URL invalidity instead of emptiness.
This CL checks for emptiness, to match the comment.

BUG=390468

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281267 0039d316-1c4b-4281-b951-d872f2087c98
components/password_manager/core/browser/password_form_manager.cc
components/password_manager/core/browser/password_form_manager.h
components/password_manager/core/browser/password_form_manager_unittest.cc
components/password_manager/core/browser/password_manager.cc