1 /* 2 * Copyright (C) 2009 Google Inc. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions are 6 * met: 7 * 8 * * Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * * Redistributions in binary form must reproduce the above 11 * copyright notice, this list of conditions and the following disclaimer 12 * in the documentation and/or other materials provided with the 13 * distribution. 14 * * Neither the name of Google Inc. nor the names of its 15 * contributors may be used to endorse or promote products derived from 16 * this software without specific prior written permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 #ifndef WebPasswordFormData_h 32 #define WebPasswordFormData_h 33 34 #include "WebFormElement.h" 35 #include "WebString.h" 36 #include "WebURL.h" 37 38 namespace WebKit { 39 40 struct WebPasswordFormData { 41 // If the provided form is suitable for password completion, isValid() will 42 // return true; 43 WEBKIT_API WebPasswordFormData(const WebFormElement&); 44 45 // If creation failed, return false. isValidWebPasswordFormData46 bool isValid() const { return action.isValid(); } 47 48 // The action target of the form. This is the primary data used by the 49 // PasswordManager for form autofill; that is, the action of the saved 50 // credentials must match the action of the form on the page to be autofilled. 51 // If this is empty / not available, it will result in a "restricted" 52 // IE-like autofill policy, where we wait for the user to type in his 53 // username before autofilling the password. In these cases, after successful 54 // login the action URL will automatically be assigned by the 55 // PasswordManager. 56 // 57 // When parsing an HTML form, this must always be set. 58 WebURL action; 59 60 // The "Realm" for the sign-on (scheme, host, port for SCHEME_HTML, and 61 // contains the HTTP realm for dialog-based forms). 62 // The signon_realm is effectively the primary key used for retrieving 63 // data from the database, so it must not be empty. 64 WebString signonRealm; 65 66 // The URL (minus query parameters) containing the form. This is the primary 67 // data used by the PasswordManager to decide (in longest matching prefix 68 // fashion) whether or not a given PasswordForm result from the database is a 69 // good fit for a particular form on a page, so it must not be empty. 70 WebURL origin; 71 72 // The name of the submit button used. Optional; only used in scoring 73 // of PasswordForm results from the database to make matches as tight as 74 // possible. 75 // 76 // When parsing an HTML form, this must always be set. 77 WebString submitElement; 78 79 // The name of the username input element. Optional (improves scoring). 80 // 81 // When parsing an HTML form, this must always be set. 82 WebString userNameElement; 83 84 // The username. Optional. 85 // 86 // When parsing an HTML form, this is typically empty unless the site 87 // has implemented some form of autofill. 88 WebString userNameValue; 89 90 // The name of the password input element, Optional (improves scoring). 91 // 92 // When parsing an HTML form, this must always be set. 93 WebString passwordElement; 94 95 // The password. Required. 96 // 97 // When parsing an HTML form, this is typically empty. 98 WebString passwordValue; 99 100 // If the form was a change password form, the name of the 101 // 'old password' input element. Optional. 102 WebString oldPasswordElement; 103 104 // The old password. Optional. 105 WebString oldPasswordValue; 106 }; 107 108 } // namespace WebKit 109 110 #endif 111