| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <ostream> | 5 #include <ostream> |
| 6 | 6 |
| 7 #include "base/strings/string16.h" | 7 #include "base/strings/string16.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "components/autofill/core/common/password_form.h" | 10 #include "components/autofill/core/common/password_form.h" |
| 11 | 11 |
| 12 namespace autofill { | 12 namespace autofill { |
| 13 | 13 |
| 14 PasswordForm::PasswordForm() | 14 PasswordForm::PasswordForm() |
| 15 : scheme(SCHEME_HTML), | 15 : scheme(SCHEME_HTML), |
| 16 username_marked_by_site(false), | 16 username_marked_by_site(false), |
| 17 password_autocomplete_set(true), | 17 password_autocomplete_set(true), |
| 18 ssl_valid(false), | 18 ssl_valid(false), |
| 19 preferred(false), | 19 preferred(false), |
| 20 blacklisted_by_user(false), | 20 blacklisted_by_user(false), |
| 21 type(TYPE_MANUAL), | 21 type(TYPE_MANUAL), |
| 22 times_used(0), | 22 times_used(0), |
| 23 generation_upload_status(NO_SIGNAL_SENT), | 23 generation_upload_status(NO_SIGNAL_SENT), |
| 24 skip_zero_click(false) { | 24 skip_zero_click(false), |
| 25 layout(Layout::LAYOUT_OTHER) { |
| 25 } | 26 } |
| 26 | 27 |
| 27 PasswordForm::~PasswordForm() { | 28 PasswordForm::~PasswordForm() { |
| 28 } | 29 } |
| 29 | 30 |
| 30 bool PasswordForm::IsPublicSuffixMatch() const { | 31 bool PasswordForm::IsPublicSuffixMatch() const { |
| 31 return !original_signon_realm.empty(); | 32 return !original_signon_realm.empty(); |
| 32 } | 33 } |
| 33 | 34 |
| 34 bool PasswordForm::operator==(const PasswordForm& form) const { | 35 bool PasswordForm::operator==(const PasswordForm& form) const { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 50 date_created == form.date_created && | 51 date_created == form.date_created && |
| 51 date_synced == form.date_synced && | 52 date_synced == form.date_synced && |
| 52 blacklisted_by_user == form.blacklisted_by_user && | 53 blacklisted_by_user == form.blacklisted_by_user && |
| 53 type == form.type && | 54 type == form.type && |
| 54 times_used == form.times_used && | 55 times_used == form.times_used && |
| 55 form_data.SameFormAs(form.form_data) && | 56 form_data.SameFormAs(form.form_data) && |
| 56 generation_upload_status == form.generation_upload_status && | 57 generation_upload_status == form.generation_upload_status && |
| 57 display_name == form.display_name && | 58 display_name == form.display_name && |
| 58 avatar_url == form.avatar_url && | 59 avatar_url == form.avatar_url && |
| 59 federation_url == form.federation_url && | 60 federation_url == form.federation_url && |
| 60 skip_zero_click == form.skip_zero_click; | 61 skip_zero_click == form.skip_zero_click && |
| 62 layout == form.layout; |
| 61 } | 63 } |
| 62 | 64 |
| 63 bool PasswordForm::operator!=(const PasswordForm& form) const { | 65 bool PasswordForm::operator!=(const PasswordForm& form) const { |
| 64 return !operator==(form); | 66 return !operator==(form); |
| 65 } | 67 } |
| 66 | 68 |
| 69 std::ostream& operator<<(std::ostream& os, PasswordForm::Layout layout) { |
| 70 switch (layout) { |
| 71 case PasswordForm::Layout::LAYOUT_OTHER: |
| 72 os << "LAYOUT_OTHER"; |
| 73 break; |
| 74 case PasswordForm::Layout::LAYOUT_LOGIN_AND_SIGNUP: |
| 75 os << "LAYOUT_LOGIN_AND_SIGNUP"; |
| 76 break; |
| 77 } |
| 78 return os; |
| 79 } |
| 80 |
| 67 std::ostream& operator<<(std::ostream& os, const PasswordForm& form) { | 81 std::ostream& operator<<(std::ostream& os, const PasswordForm& form) { |
| 68 return os << "scheme: " << form.scheme | 82 return os << "scheme: " << form.scheme |
| 69 << " signon_realm: " << form.signon_realm | 83 << " signon_realm: " << form.signon_realm |
| 70 << " origin: " << form.origin | 84 << " origin: " << form.origin |
| 71 << " action: " << form.action | 85 << " action: " << form.action |
| 72 << " submit_element: " << base::UTF16ToUTF8(form.submit_element) | 86 << " submit_element: " << base::UTF16ToUTF8(form.submit_element) |
| 73 << " username_elem: " << base::UTF16ToUTF8(form.username_element) | 87 << " username_elem: " << base::UTF16ToUTF8(form.username_element) |
| 74 << " username_marked_by_site: " << form.username_marked_by_site | 88 << " username_marked_by_site: " << form.username_marked_by_site |
| 75 << " username_value: " << base::UTF16ToUTF8(form.username_value) | 89 << " username_value: " << base::UTF16ToUTF8(form.username_value) |
| 76 << " password_elem: " << base::UTF16ToUTF8(form.password_element) | 90 << " password_elem: " << base::UTF16ToUTF8(form.password_element) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 87 << " ssl_valid: " << form.ssl_valid | 101 << " ssl_valid: " << form.ssl_valid |
| 88 << " date_created: " << form.date_created.ToDoubleT() | 102 << " date_created: " << form.date_created.ToDoubleT() |
| 89 << " date_synced: " << form.date_synced.ToDoubleT() | 103 << " date_synced: " << form.date_synced.ToDoubleT() |
| 90 << " type: " << form.type | 104 << " type: " << form.type |
| 91 << " times_used: " << form.times_used | 105 << " times_used: " << form.times_used |
| 92 << " form_data: " << form.form_data | 106 << " form_data: " << form.form_data |
| 93 << " generation_upload_status: " << form.generation_upload_status | 107 << " generation_upload_status: " << form.generation_upload_status |
| 94 << " display_name: " << base::UTF16ToUTF8(form.display_name) | 108 << " display_name: " << base::UTF16ToUTF8(form.display_name) |
| 95 << " avatar_url: " << form.avatar_url | 109 << " avatar_url: " << form.avatar_url |
| 96 << " federation_url: " << form.federation_url | 110 << " federation_url: " << form.federation_url |
| 97 << " skip_next_zero_click: " << form.skip_zero_click; | 111 << " skip_next_zero_click: " << form.skip_zero_click |
| 112 << " layout: " << form.layout; |
| 98 } | 113 } |
| 99 | 114 |
| 100 } // namespace autofill | 115 } // namespace autofill |
| OLD | NEW |