1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include <ostream> 6 7 #include "base/strings/string16.h" 8 #include "base/strings/utf_string_conversions.h" 9 #include "components/autofill/core/common/password_form.h" 10 11 namespace autofill { 12 13 PasswordForm::PasswordForm() 14 : scheme(SCHEME_HTML), 15 password_autocomplete_set(true), 16 ssl_valid(false), 17 preferred(false), 18 blacklisted_by_user(false), 19 type(TYPE_MANUAL), 20 times_used(0) { 21 } 22 23 PasswordForm::~PasswordForm() { 24 } 25 26 bool PasswordForm::IsPublicSuffixMatch() const { 27 return !original_signon_realm.empty(); 28 } 29 30 bool PasswordForm::operator==(const PasswordForm& form) const { 31 return signon_realm == form.signon_realm && 32 origin == form.origin && 33 action == form.action && 34 submit_element == form.submit_element && 35 username_element == form.username_element && 36 username_value == form.username_value && 37 other_possible_usernames == form.other_possible_usernames && 38 password_element == form.password_element && 39 password_value == form.password_value && 40 password_autocomplete_set == form.password_autocomplete_set && 41 old_password_element == form.old_password_element && 42 old_password_value == form.old_password_value && 43 ssl_valid == form.ssl_valid && 44 preferred == form.preferred && 45 date_created == form.date_created && 46 blacklisted_by_user == form.blacklisted_by_user && 47 type == form.type && 48 times_used == form.times_used && 49 form_data == form.form_data; 50 } 51 52 bool PasswordForm::operator!=(const PasswordForm& form) const { 53 return !operator==(form); 54 } 55 56 std::ostream& operator<<(std::ostream& os, const PasswordForm& form) { 57 return os << "scheme: " << form.scheme 58 << " signon_realm: " << form.signon_realm 59 << " origin: " << form.origin 60 << " action: " << form.action 61 << " submit_element: " << UTF16ToUTF8(form.submit_element) 62 << " username_elem: " << UTF16ToUTF8(form.username_element) 63 << " username_value: " << UTF16ToUTF8(form.username_value) 64 << " password_elem: " << UTF16ToUTF8(form.password_element) 65 << " password_value: " << UTF16ToUTF8(form.password_value) 66 << " old_password_element: " 67 << UTF16ToUTF8(form.old_password_element) 68 << " old_password_value: " << UTF16ToUTF8(form.old_password_value) 69 << " autocomplete_set:" << form.password_autocomplete_set 70 << " blacklisted: " << form.blacklisted_by_user 71 << " preferred: " << form.preferred 72 << " ssl_valid: " << form.ssl_valid 73 << " date_created: " << form.date_created.ToDoubleT() 74 << " type: " << form.type 75 << " times_used: " << form.times_used 76 << " form_data: " << form.form_data; 77 } 78 79 } // namespace autofill 80