| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 target->SetDouble("date_created", form.date_created.ToDoubleT()); | 49 target->SetDouble("date_created", form.date_created.ToDoubleT()); |
| 50 target->SetDouble("date_synced", form.date_synced.ToDoubleT()); | 50 target->SetDouble("date_synced", form.date_synced.ToDoubleT()); |
| 51 target->SetInteger("type", form.type); | 51 target->SetInteger("type", form.type); |
| 52 target->SetInteger("times_used", form.times_used); | 52 target->SetInteger("times_used", form.times_used); |
| 53 std::ostringstream form_data_string_stream; | 53 std::ostringstream form_data_string_stream; |
| 54 form_data_string_stream << form.form_data; | 54 form_data_string_stream << form.form_data; |
| 55 target->SetString("form_data", form_data_string_stream.str()); | 55 target->SetString("form_data", form_data_string_stream.str()); |
| 56 target->SetInteger("generation_upload_status", form.generation_upload_status); | 56 target->SetInteger("generation_upload_status", form.generation_upload_status); |
| 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_url", | 59 target->SetString("federation_origin", form.federation_origin.Serialize()); |
| 60 form.federation_url.possibly_invalid_spec()); | |
| 61 target->SetBoolean("skip_next_zero_click", form.skip_zero_click); | 60 target->SetBoolean("skip_next_zero_click", form.skip_zero_click); |
| 62 std::ostringstream layout_string_stream; | 61 std::ostringstream layout_string_stream; |
| 63 layout_string_stream << form.layout; | 62 layout_string_stream << form.layout; |
| 64 target->SetString("layout", layout_string_stream.str()); | 63 target->SetString("layout", layout_string_stream.str()); |
| 65 target->SetBoolean("was_parsed_using_autofill_predictions", | 64 target->SetBoolean("was_parsed_using_autofill_predictions", |
| 66 form.was_parsed_using_autofill_predictions); | 65 form.was_parsed_using_autofill_predictions); |
| 67 } | 66 } |
| 68 | 67 |
| 69 } // namespace | 68 } // namespace |
| 70 | 69 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 new_password_element == form.new_password_element && | 110 new_password_element == form.new_password_element && |
| 112 new_password_marked_by_site == form.new_password_marked_by_site && | 111 new_password_marked_by_site == form.new_password_marked_by_site && |
| 113 new_password_value == form.new_password_value && | 112 new_password_value == form.new_password_value && |
| 114 ssl_valid == form.ssl_valid && preferred == form.preferred && | 113 ssl_valid == form.ssl_valid && preferred == form.preferred && |
| 115 date_created == form.date_created && date_synced == form.date_synced && | 114 date_created == form.date_created && date_synced == form.date_synced && |
| 116 blacklisted_by_user == form.blacklisted_by_user && type == form.type && | 115 blacklisted_by_user == form.blacklisted_by_user && type == form.type && |
| 117 times_used == form.times_used && | 116 times_used == form.times_used && |
| 118 form_data.SameFormAs(form.form_data) && | 117 form_data.SameFormAs(form.form_data) && |
| 119 generation_upload_status == form.generation_upload_status && | 118 generation_upload_status == form.generation_upload_status && |
| 120 display_name == form.display_name && icon_url == form.icon_url && | 119 display_name == form.display_name && icon_url == form.icon_url && |
| 121 federation_url == form.federation_url && | 120 // We compare the serialization of the origins here, as we want unique |
| 121 // origins to compare as '=='. |
| 122 federation_origin.Serialize() == form.federation_origin.Serialize() && |
| 122 skip_zero_click == form.skip_zero_click && layout == form.layout && | 123 skip_zero_click == form.skip_zero_click && layout == form.layout && |
| 123 was_parsed_using_autofill_predictions == | 124 was_parsed_using_autofill_predictions == |
| 124 form.was_parsed_using_autofill_predictions && | 125 form.was_parsed_using_autofill_predictions && |
| 125 is_public_suffix_match == form.is_public_suffix_match && | 126 is_public_suffix_match == form.is_public_suffix_match && |
| 126 is_affiliation_based_match == form.is_affiliation_based_match; | 127 is_affiliation_based_match == form.is_affiliation_based_match; |
| 127 } | 128 } |
| 128 | 129 |
| 129 bool PasswordForm::operator!=(const PasswordForm& form) const { | 130 bool PasswordForm::operator!=(const PasswordForm& form) const { |
| 130 return !operator==(form); | 131 return !operator==(form); |
| 131 } | 132 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 form_json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &form_as_string); | 195 form_json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &form_as_string); |
| 195 base::TrimWhitespaceASCII(form_as_string, base::TRIM_ALL, &form_as_string); | 196 base::TrimWhitespaceASCII(form_as_string, base::TRIM_ALL, &form_as_string); |
| 196 return os << "PasswordForm(" << form_as_string << ")"; | 197 return os << "PasswordForm(" << form_as_string << ")"; |
| 197 } | 198 } |
| 198 | 199 |
| 199 std::ostream& operator<<(std::ostream& os, PasswordForm* form) { | 200 std::ostream& operator<<(std::ostream& os, PasswordForm* form) { |
| 200 return os << "&" << *form; | 201 return os << "&" << *form; |
| 201 } | 202 } |
| 202 | 203 |
| 203 } // namespace autofill | 204 } // namespace autofill |
| OLD | NEW |