Chromium Code Reviews| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 target->SetString("display_name", form.display_name); | 52 target->SetString("display_name", form.display_name); |
| 53 target->SetString("avatar_url", form.avatar_url.possibly_invalid_spec()); | 53 target->SetString("avatar_url", form.avatar_url.possibly_invalid_spec()); |
| 54 target->SetString("federation_url", | 54 target->SetString("federation_url", |
| 55 form.federation_url.possibly_invalid_spec()); | 55 form.federation_url.possibly_invalid_spec()); |
| 56 target->SetBoolean("skip_next_zero_click", form.skip_zero_click); | 56 target->SetBoolean("skip_next_zero_click", form.skip_zero_click); |
| 57 std::ostringstream layout_string_stream; | 57 std::ostringstream layout_string_stream; |
| 58 layout_string_stream << form.layout; | 58 layout_string_stream << form.layout; |
| 59 target->SetString("layout", layout_string_stream.str()); | 59 target->SetString("layout", layout_string_stream.str()); |
| 60 target->SetBoolean("was_parsed_using_autofill_predictions", | 60 target->SetBoolean("was_parsed_using_autofill_predictions", |
| 61 form.was_parsed_using_autofill_predictions); | 61 form.was_parsed_using_autofill_predictions); |
| 62 target->SetBoolean("is_password_change_form_without_username", | |
| 63 form.is_password_change_form_without_username); | |
| 62 } | 64 } |
| 63 | 65 |
| 64 } // namespace | 66 } // namespace |
| 65 | 67 |
| 66 PasswordForm::PasswordForm() | 68 PasswordForm::PasswordForm() |
| 67 : scheme(SCHEME_HTML), | 69 : scheme(SCHEME_HTML), |
| 68 username_marked_by_site(false), | 70 username_marked_by_site(false), |
| 69 password_autocomplete_set(true), | 71 password_autocomplete_set(true), |
| 70 new_password_marked_by_site(false), | 72 new_password_marked_by_site(false), |
| 71 ssl_valid(false), | 73 ssl_valid(false), |
| 72 preferred(false), | 74 preferred(false), |
| 73 blacklisted_by_user(false), | 75 blacklisted_by_user(false), |
| 74 type(TYPE_MANUAL), | 76 type(TYPE_MANUAL), |
| 75 times_used(0), | 77 times_used(0), |
| 76 generation_upload_status(NO_SIGNAL_SENT), | 78 generation_upload_status(NO_SIGNAL_SENT), |
| 77 skip_zero_click(false), | 79 skip_zero_click(false), |
| 78 layout(Layout::LAYOUT_OTHER), | 80 layout(Layout::LAYOUT_OTHER), |
| 79 was_parsed_using_autofill_predictions(false), | 81 was_parsed_using_autofill_predictions(false), |
| 80 is_alive(true) { | 82 is_alive(true), |
| 83 is_password_change_form_without_username(false) { | |
| 81 } | 84 } |
| 82 | 85 |
| 83 PasswordForm::~PasswordForm() { | 86 PasswordForm::~PasswordForm() { |
| 84 CHECK(is_alive); | 87 CHECK(is_alive); |
| 85 is_alive = false; | 88 is_alive = false; |
| 86 } | 89 } |
| 87 | 90 |
| 88 bool PasswordForm::IsPublicSuffixMatch() const { | 91 bool PasswordForm::IsPublicSuffixMatch() const { |
| 89 CHECK(is_alive); | 92 CHECK(is_alive); |
| 90 return !original_signon_realm.empty(); | 93 return !original_signon_realm.empty(); |
| 91 } | 94 } |
| 92 | 95 |
| 93 bool PasswordForm::operator==(const PasswordForm& form) const { | 96 bool PasswordForm::operator==(const PasswordForm& form) const { |
| 94 return scheme == form.scheme && | 97 return scheme == form.scheme && signon_realm == form.signon_realm && |
| 95 signon_realm == form.signon_realm && | 98 original_signon_realm == form.original_signon_realm && |
|
vabr (Chromium)
2015/06/19 18:03:16
Please keep this one equality check per line. I kn
dvadym
2015/06/22 14:43:33
Done.
| |
| 96 original_signon_realm == form.original_signon_realm && | 99 origin == form.origin && action == form.action && |
| 97 origin == form.origin && | 100 submit_element == form.submit_element && |
| 98 action == form.action && | 101 username_element == form.username_element && |
| 99 submit_element == form.submit_element && | 102 username_marked_by_site == form.username_marked_by_site && |
| 100 username_element == form.username_element && | 103 username_value == form.username_value && |
| 101 username_marked_by_site == form.username_marked_by_site && | 104 other_possible_usernames == form.other_possible_usernames && |
| 102 username_value == form.username_value && | 105 password_element == form.password_element && |
| 103 other_possible_usernames == form.other_possible_usernames && | 106 password_value == form.password_value && |
| 104 password_element == form.password_element && | 107 password_autocomplete_set == form.password_autocomplete_set && |
| 105 password_value == form.password_value && | 108 new_password_element == form.new_password_element && |
| 106 password_autocomplete_set == form.password_autocomplete_set && | 109 new_password_marked_by_site == form.new_password_marked_by_site && |
| 107 new_password_element == form.new_password_element && | 110 new_password_value == form.new_password_value && |
| 108 new_password_marked_by_site == form.new_password_marked_by_site && | 111 ssl_valid == form.ssl_valid && preferred == form.preferred && |
| 109 new_password_value == form.new_password_value && | 112 date_created == form.date_created && date_synced == form.date_synced && |
| 110 ssl_valid == form.ssl_valid && | 113 blacklisted_by_user == form.blacklisted_by_user && type == form.type && |
| 111 preferred == form.preferred && | 114 times_used == form.times_used && |
| 112 date_created == form.date_created && | 115 form_data.SameFormAs(form.form_data) && |
| 113 date_synced == form.date_synced && | 116 generation_upload_status == form.generation_upload_status && |
| 114 blacklisted_by_user == form.blacklisted_by_user && | 117 display_name == form.display_name && avatar_url == form.avatar_url && |
| 115 type == form.type && | 118 federation_url == form.federation_url && |
| 116 times_used == form.times_used && | 119 skip_zero_click == form.skip_zero_click && layout == form.layout && |
| 117 form_data.SameFormAs(form.form_data) && | 120 was_parsed_using_autofill_predictions == |
| 118 generation_upload_status == form.generation_upload_status && | 121 form.was_parsed_using_autofill_predictions && |
| 119 display_name == form.display_name && | 122 is_password_change_form_without_username == |
| 120 avatar_url == form.avatar_url && | 123 form.is_password_change_form_without_username; |
| 121 federation_url == form.federation_url && | |
| 122 skip_zero_click == form.skip_zero_click && | |
| 123 layout == form.layout && | |
| 124 was_parsed_using_autofill_predictions == | |
| 125 form.was_parsed_using_autofill_predictions; | |
| 126 } | 124 } |
| 127 | 125 |
| 128 bool PasswordForm::operator!=(const PasswordForm& form) const { | 126 bool PasswordForm::operator!=(const PasswordForm& form) const { |
| 129 return !operator==(form); | 127 return !operator==(form); |
| 130 } | 128 } |
| 131 | 129 |
| 132 std::ostream& operator<<(std::ostream& os, PasswordForm::Layout layout) { | 130 std::ostream& operator<<(std::ostream& os, PasswordForm::Layout layout) { |
| 133 switch (layout) { | 131 switch (layout) { |
| 134 case PasswordForm::Layout::LAYOUT_OTHER: | 132 case PasswordForm::Layout::LAYOUT_OTHER: |
| 135 os << "LAYOUT_OTHER"; | 133 os << "LAYOUT_OTHER"; |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 163 form_json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &form_as_string); | 161 form_json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &form_as_string); |
| 164 base::TrimWhitespaceASCII(form_as_string, base::TRIM_ALL, &form_as_string); | 162 base::TrimWhitespaceASCII(form_as_string, base::TRIM_ALL, &form_as_string); |
| 165 return os << "PasswordForm(" << form_as_string << ")"; | 163 return os << "PasswordForm(" << form_as_string << ")"; |
| 166 } | 164 } |
| 167 | 165 |
| 168 std::ostream& operator<<(std::ostream& os, PasswordForm* form) { | 166 std::ostream& operator<<(std::ostream& os, PasswordForm* form) { |
| 169 return os << "&" << *form; | 167 return os << "&" << *form; |
| 170 } | 168 } |
| 171 | 169 |
| 172 } // namespace autofill | 170 } // namespace autofill |
| OLD | NEW |