158537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#ifndef COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__ 658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#define COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <map> 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <string> 10c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)#include <vector> 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 12eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch#include "base/time/time.h" 13d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)#include "components/autofill/core/common/form_data.h" 147dbb3d5cf0c15f500944d211057644d6a2f37371Ben Murdoch#include "url/gurl.h" 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)namespace autofill { 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The PasswordForm struct encapsulates information about a login form, 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// which can be an HTML form or a dialog with username/password text fields. 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The Web Data database stores saved username/passwords and associated form 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// metdata using a PasswordForm struct, typically one that was created from 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// a parsed HTMLFormElement or LoginDialog, but the saved entries could have 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// also been created by imported data from another browser. 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The PasswordManager implements a fuzzy-matching algorithm to compare saved 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// PasswordForm entries against PasswordForms that were created from a parsed 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// HTML or dialog form. As one might expect, the more data contained in one 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// of the saved PasswordForms, the better the job the PasswordManager can do 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// in matching it against the actual form it was saved on, and autofill 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// accurately. But it is not always possible, especially when importing from 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// other browsers with different data models, to copy over all the information 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// about a particular "saved password entry" to our PasswordForm 345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// representation. 355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// The field descriptions in the struct specification below are intended to 375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// describe which fields are not strictly required when adding a saved password 385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// entry to the database and how they can affect the matching process. 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4058537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)struct PasswordForm { 415821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Enum to differentiate between HTML form based authentication, and dialogs 425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // using basic or digest schemes. Default is SCHEME_HTML. Only PasswordForms 435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // of the same Scheme will be matched/autofilled against each other. 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) enum Scheme { 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) SCHEME_HTML, 465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) SCHEME_BASIC, 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) SCHEME_DIGEST, 48f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) SCHEME_OTHER, 49f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) SCHEME_LAST = SCHEME_OTHER 505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } scheme; 515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The "Realm" for the sign-on (scheme, host, port for SCHEME_HTML, and 535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // contains the HTTP realm for dialog-based forms). 545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The signon_realm is effectively the primary key used for retrieving 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // data from the database, so it must not be empty. 565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) std::string signon_realm; 575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 58eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // The original "Realm" for the sign-on (scheme, host, port for SCHEME_HTML, 59eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // and contains the HTTP realm for dialog-based forms). This realm is only set 60eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // when two PasswordForms are matched when trying to find a login/pass pair 61eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // for a site. It is only set to a non-empty value during a match of the 62eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // original stored login/pass and the current observed form if all these 63eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // statements are true: 64eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // 1) The full signon_realm is not the same. 65eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // 2) The registry controlled domain is the same. For example; example.com, 66eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // m.example.com, foo.login.example.com and www.example.com would all resolve 67eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // to example.com since .com is the public suffix. 68eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // 3) The scheme is the same. 69eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // 4) The port is the same. 70eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // For example, if there exists a stored password for http://www.example.com 71eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // (where .com is the public suffix) and the observed form is 72eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // http://m.example.com, |original_signon_realm| must be set to 73eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // http://www.example.com. 74eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch std::string original_signon_realm; 75eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch 765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The URL (minus query parameters) containing the form. This is the primary 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // data used by the PasswordManager to decide (in longest matching prefix 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // fashion) whether or not a given PasswordForm result from the database is a 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // good fit for a particular form on a page, so it must not be empty. 805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GURL origin; 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The action target of the form. This is the primary data used by the 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // PasswordManager for form autofill; that is, the action of the saved 845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // credentials must match the action of the form on the page to be autofilled. 855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // If this is empty / not available, it will result in a "restricted" 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // IE-like autofill policy, where we wait for the user to type in his 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // username before autofilling the password. In these cases, after successful 885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // login the action URL will automatically be assigned by the 895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // PasswordManager. 905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // 915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // When parsing an HTML form, this must always be set. 925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) GURL action; 935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The name of the submit button used. Optional; only used in scoring 955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // of PasswordForm results from the database to make matches as tight as 965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // possible. 975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // 985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // When parsing an HTML form, this must always be set. 99a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 submit_element; 1005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The name of the username input element. Optional (improves scoring). 1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // When parsing an HTML form, this must always be set. 104a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 username_element; 1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The username. Optional. 1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // 1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // When parsing an HTML form, this is typically empty unless the site 1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // has implemented some form of autofill. 110a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 username_value; 1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 112c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // This member is populated in cases where we there are multiple input 113c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // elements that could possibly be the username. Used when our heuristics for 114c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // determining the username are incorrect. Optional. 115c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // 116c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // When parsing an HTML form, this is typically empty. 117a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) std::vector<base::string16> other_possible_usernames; 118c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 119116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // The name of the input element corresponding to the current password. 120116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // Optional (improves scoring). 1215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // 122116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // When parsing an HTML form, this will always be set, unless it is a sign-up 123116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // form or a change password form that does not ask for the current password. 124116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // In these two cases the |new_password_element| will always be set. 125a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 password_element; 1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 127116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // The current password. Must be non-empty for PasswordForm instances that are 128116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // meant to be persisted to the password store. 1295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // 1305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // When parsing an HTML form, this is typically empty. 131a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) base::string16 password_value; 1322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1335d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // False if autocomplete is set to "off" for the password input element; 1345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // True otherwise. 1355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) bool password_autocomplete_set; 1365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 137116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // If the form was a sign-up or a change password form, the name of the input 138116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // element corresponding to the new password. Optional, and not persisted. 139116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch base::string16 new_password_element; 1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 141116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch // The new password. Optional, and not persisted. 142116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch base::string16 new_password_value; 1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Whether or not this login was saved under an HTTPS session with a valid 1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // SSL cert. We will never match or autofill a PasswordForm where 1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // ssl_valid == true with a PasswordForm where ssl_valid == false. This means 1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // passwords saved under HTTPS will never get autofilled onto an HTTP page. 1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // When importing, this should be set to true if the page URL is HTTPS, thus 1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // giving it "the benefit of the doubt" that the SSL cert was valid when it 1505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // was saved. Default to false. 1515821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool ssl_valid; 1525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // True if this PasswordForm represents the last username/password login the 1545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // user selected to log in to the site. If there is only one saved entry for 1555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // the site, this will always be true, but when there are multiple entries 1565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // the PasswordManager ensures that only one of them has a preferred bit set 1575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // to true. Default to false. 1585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // 1595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // When parsing an HTML form, this is not used. 1605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool preferred; 1615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // When the login was saved (by chrome). 1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // 1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // When parsing an HTML form, this is not used. 1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) base::Time date_created; 1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 167f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // When the login was downloaded from the sync server. For local passwords is 168f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // not used. 169f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // 170f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // When parsing an HTML form, this is not used. 171f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) base::Time date_synced; 172f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) 1735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Tracks if the user opted to never remember passwords for this form. Default 1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // to false. 1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // 1765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // When parsing an HTML form, this is not used. 1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool blacklisted_by_user; 1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Enum to differentiate between manually filled forms and forms with auto 1805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // generated passwords. 1815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) enum Type { 1825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) TYPE_MANUAL, 1835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) TYPE_GENERATED, 1845d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) TYPE_LAST = TYPE_GENERATED 1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) }; 1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The form type. Not used yet. Please see http://crbug.com/152422 1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Type type; 1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 19090dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // The number of times that this username/password has been used to 19190dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // authenticate the user. 19290dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // 19390dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) // When parsing an HTML form, this is not used. 19490dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) int times_used; 19590dce4d38c5ff5333bea97d859d4e484e27edf0cTorne (Richard Coles) 1965d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // True if additional system level authentication should be used 1975d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // (if available) before using this password for autofill. 1985d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // 1995d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Default to false. 2005d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) bool use_additional_authentication; 2015d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) 202d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // Autofill representation of this form. Used to communicate with the 203d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // Autofill servers if necessary. Currently this is only used to help 204d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // determine forms where we can trigger password generation. 205d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // 206d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // When parsing an HTML form, this is normally set. 207d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) FormData form_data; 208d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) 20903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) // These following fields are set by a website using the Credential Manager 21003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) // API. They will be empty and remain unused for sites which do not use that 21103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) // API. 21203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) // 21303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) // User friendly name to show in the UI. 21403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) base::string16 display_name; 21503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 21603b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) // The URL of the user's avatar to display in the UI. 21703b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) GURL avatar_url; 21803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 21903b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) // The URL of identity provider used for federated login. 22003b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) GURL federation_url; 22103b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 22203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) // If true, Chrome will sign the user in automatically using the credentials. 2231320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci // This field isn't synced deliberately. 22403b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) bool is_zero_click; 22503b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles) 226eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch // Returns true if this match was found using public suffix matching. 227eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch bool IsPublicSuffixMatch() const; 228eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch 229d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) // Equality operators for testing. 230d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) bool operator==(const PasswordForm& form) const; 231d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) bool operator!=(const PasswordForm& form) const; 232d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) 2335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) PasswordForm(); 2345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ~PasswordForm(); 2355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 2365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Map username to PasswordForm* for convenience. See password_form_manager.h. 238a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)typedef std::map<base::string16, PasswordForm*> PasswordFormMap; 2395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2405f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)typedef std::map<base::string16, const PasswordForm*> ConstPasswordFormMap; 2415f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles) 242d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)// For testing. 243d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)std::ostream& operator<<(std::ostream& os, 244d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) const autofill::PasswordForm& form); 245d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) 24658537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)} // namespace autofill 2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 24858537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#endif // COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__ 249