| 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 #include <sstream> | 6 #include <sstream> |
| 7 | 7 |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 target->SetString("display_name", form.display_name); | 57 target->SetString("display_name", form.display_name); |
| 58 target->SetString("icon_url", form.icon_url.possibly_invalid_spec()); | 58 target->SetString("icon_url", form.icon_url.possibly_invalid_spec()); |
| 59 target->SetString("federation_origin", form.federation_origin.Serialize()); | 59 target->SetString("federation_origin", form.federation_origin.Serialize()); |
| 60 target->SetBoolean("skip_next_zero_click", form.skip_zero_click); | 60 target->SetBoolean("skip_next_zero_click", form.skip_zero_click); |
| 61 std::ostringstream layout_string_stream; | 61 std::ostringstream layout_string_stream; |
| 62 layout_string_stream << form.layout; | 62 layout_string_stream << form.layout; |
| 63 target->SetString("layout", layout_string_stream.str()); | 63 target->SetString("layout", layout_string_stream.str()); |
| 64 target->SetBoolean("was_parsed_using_autofill_predictions", | 64 target->SetBoolean("was_parsed_using_autofill_predictions", |
| 65 form.was_parsed_using_autofill_predictions); | 65 form.was_parsed_using_autofill_predictions); |
| 66 target->SetString("affiliated_web_realm", form.affiliated_web_realm); | 66 target->SetString("affiliated_web_realm", form.affiliated_web_realm); |
| 67 target->SetBoolean("does_look_like_signup_form", |
| 68 form.does_look_like_signup_form); |
| 67 } | 69 } |
| 68 | 70 |
| 69 } // namespace | 71 } // namespace |
| 70 | 72 |
| 71 PasswordForm::PasswordForm() | 73 PasswordForm::PasswordForm() |
| 72 : scheme(SCHEME_HTML), | 74 : scheme(SCHEME_HTML), |
| 73 username_marked_by_site(false), | 75 username_marked_by_site(false), |
| 74 password_value_is_default(false), | 76 password_value_is_default(false), |
| 75 new_password_value_is_default(false), | 77 new_password_value_is_default(false), |
| 76 new_password_marked_by_site(false), | 78 new_password_marked_by_site(false), |
| 77 ssl_valid(false), | 79 ssl_valid(false), |
| 78 preferred(false), | 80 preferred(false), |
| 79 blacklisted_by_user(false), | 81 blacklisted_by_user(false), |
| 80 type(TYPE_MANUAL), | 82 type(TYPE_MANUAL), |
| 81 times_used(0), | 83 times_used(0), |
| 82 generation_upload_status(NO_SIGNAL_SENT), | 84 generation_upload_status(NO_SIGNAL_SENT), |
| 83 skip_zero_click(true), | 85 skip_zero_click(true), |
| 84 layout(Layout::LAYOUT_OTHER), | 86 layout(Layout::LAYOUT_OTHER), |
| 85 was_parsed_using_autofill_predictions(false), | 87 was_parsed_using_autofill_predictions(false), |
| 86 is_public_suffix_match(false), | 88 is_public_suffix_match(false), |
| 87 is_affiliation_based_match(false) {} | 89 is_affiliation_based_match(false), |
| 90 does_look_like_signup_form(false) {} |
| 88 | 91 |
| 89 PasswordForm::PasswordForm(const PasswordForm& other) = default; | 92 PasswordForm::PasswordForm(const PasswordForm& other) = default; |
| 90 | 93 |
| 91 PasswordForm::~PasswordForm() { | 94 PasswordForm::~PasswordForm() { |
| 92 } | 95 } |
| 93 | 96 |
| 94 bool PasswordForm::IsPossibleChangePasswordForm() const { | 97 bool PasswordForm::IsPossibleChangePasswordForm() const { |
| 95 return !new_password_element.empty() && | 98 return !new_password_element.empty() && |
| 96 layout != PasswordForm::Layout::LAYOUT_LOGIN_AND_SIGNUP; | 99 layout != PasswordForm::Layout::LAYOUT_LOGIN_AND_SIGNUP; |
| 97 } | 100 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 121 generation_upload_status == form.generation_upload_status && | 124 generation_upload_status == form.generation_upload_status && |
| 122 display_name == form.display_name && icon_url == form.icon_url && | 125 display_name == form.display_name && icon_url == form.icon_url && |
| 123 // We compare the serialization of the origins here, as we want unique | 126 // We compare the serialization of the origins here, as we want unique |
| 124 // origins to compare as '=='. | 127 // origins to compare as '=='. |
| 125 federation_origin.Serialize() == form.federation_origin.Serialize() && | 128 federation_origin.Serialize() == form.federation_origin.Serialize() && |
| 126 skip_zero_click == form.skip_zero_click && layout == form.layout && | 129 skip_zero_click == form.skip_zero_click && layout == form.layout && |
| 127 was_parsed_using_autofill_predictions == | 130 was_parsed_using_autofill_predictions == |
| 128 form.was_parsed_using_autofill_predictions && | 131 form.was_parsed_using_autofill_predictions && |
| 129 is_public_suffix_match == form.is_public_suffix_match && | 132 is_public_suffix_match == form.is_public_suffix_match && |
| 130 is_affiliation_based_match == form.is_affiliation_based_match && | 133 is_affiliation_based_match == form.is_affiliation_based_match && |
| 131 affiliated_web_realm == form.affiliated_web_realm; | 134 affiliated_web_realm == form.affiliated_web_realm && |
| 135 does_look_like_signup_form == form.does_look_like_signup_form; |
| 132 } | 136 } |
| 133 | 137 |
| 134 bool PasswordForm::operator!=(const PasswordForm& form) const { | 138 bool PasswordForm::operator!=(const PasswordForm& form) const { |
| 135 return !operator==(form); | 139 return !operator==(form); |
| 136 } | 140 } |
| 137 | 141 |
| 138 bool ArePasswordFormUniqueKeyEqual(const PasswordForm& left, | 142 bool ArePasswordFormUniqueKeyEqual(const PasswordForm& left, |
| 139 const PasswordForm& right) { | 143 const PasswordForm& right) { |
| 140 return (left.signon_realm == right.signon_realm && | 144 return (left.signon_realm == right.signon_realm && |
| 141 left.origin == right.origin && | 145 left.origin == right.origin && |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 form_json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &form_as_string); | 203 form_json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &form_as_string); |
| 200 base::TrimWhitespaceASCII(form_as_string, base::TRIM_ALL, &form_as_string); | 204 base::TrimWhitespaceASCII(form_as_string, base::TRIM_ALL, &form_as_string); |
| 201 return os << "PasswordForm(" << form_as_string << ")"; | 205 return os << "PasswordForm(" << form_as_string << ")"; |
| 202 } | 206 } |
| 203 | 207 |
| 204 std::ostream& operator<<(std::ostream& os, PasswordForm* form) { | 208 std::ostream& operator<<(std::ostream& os, PasswordForm* form) { |
| 205 return os << "&" << *form; | 209 return os << "&" << *form; |
| 206 } | 210 } |
| 207 | 211 |
| 208 } // namespace autofill | 212 } // namespace autofill |
| OLD | NEW |