| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 target->SetString("form_data", form_data_string_stream.str()); | 48 target->SetString("form_data", form_data_string_stream.str()); |
| 49 target->SetInteger("generation_upload_status", form.generation_upload_status); | 49 target->SetInteger("generation_upload_status", form.generation_upload_status); |
| 50 target->SetString("display_name", form.display_name); | 50 target->SetString("display_name", form.display_name); |
| 51 target->SetString("avatar_url", form.avatar_url.possibly_invalid_spec()); | 51 target->SetString("avatar_url", form.avatar_url.possibly_invalid_spec()); |
| 52 target->SetString("federation_url", | 52 target->SetString("federation_url", |
| 53 form.federation_url.possibly_invalid_spec()); | 53 form.federation_url.possibly_invalid_spec()); |
| 54 target->SetBoolean("skip_next_zero_click", form.skip_zero_click); | 54 target->SetBoolean("skip_next_zero_click", form.skip_zero_click); |
| 55 std::ostringstream layout_string_stream; | 55 std::ostringstream layout_string_stream; |
| 56 layout_string_stream << form.layout; | 56 layout_string_stream << form.layout; |
| 57 target->SetString("layout", layout_string_stream.str()); | 57 target->SetString("layout", layout_string_stream.str()); |
| 58 target->SetBoolean("was_parsed_using_autofill_predictions", |
| 59 form.was_parsed_using_autofill_predictions); |
| 58 } | 60 } |
| 59 | 61 |
| 60 } // namespace | 62 } // namespace |
| 61 | 63 |
| 62 PasswordForm::PasswordForm() | 64 PasswordForm::PasswordForm() |
| 63 : scheme(SCHEME_HTML), | 65 : scheme(SCHEME_HTML), |
| 64 username_marked_by_site(false), | 66 username_marked_by_site(false), |
| 65 password_autocomplete_set(true), | 67 password_autocomplete_set(true), |
| 66 ssl_valid(false), | 68 ssl_valid(false), |
| 67 preferred(false), | 69 preferred(false), |
| 68 blacklisted_by_user(false), | 70 blacklisted_by_user(false), |
| 69 type(TYPE_MANUAL), | 71 type(TYPE_MANUAL), |
| 70 times_used(0), | 72 times_used(0), |
| 71 generation_upload_status(NO_SIGNAL_SENT), | 73 generation_upload_status(NO_SIGNAL_SENT), |
| 72 skip_zero_click(false), | 74 skip_zero_click(false), |
| 73 layout(Layout::LAYOUT_OTHER) { | 75 layout(Layout::LAYOUT_OTHER), |
| 76 was_parsed_using_autofill_predictions(false) { |
| 74 } | 77 } |
| 75 | 78 |
| 76 PasswordForm::~PasswordForm() { | 79 PasswordForm::~PasswordForm() { |
| 77 } | 80 } |
| 78 | 81 |
| 79 bool PasswordForm::IsPublicSuffixMatch() const { | 82 bool PasswordForm::IsPublicSuffixMatch() const { |
| 80 return !original_signon_realm.empty(); | 83 return !original_signon_realm.empty(); |
| 81 } | 84 } |
| 82 | 85 |
| 83 bool PasswordForm::operator==(const PasswordForm& form) const { | 86 bool PasswordForm::operator==(const PasswordForm& form) const { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 102 date_synced == form.date_synced && | 105 date_synced == form.date_synced && |
| 103 blacklisted_by_user == form.blacklisted_by_user && | 106 blacklisted_by_user == form.blacklisted_by_user && |
| 104 type == form.type && | 107 type == form.type && |
| 105 times_used == form.times_used && | 108 times_used == form.times_used && |
| 106 form_data.SameFormAs(form.form_data) && | 109 form_data.SameFormAs(form.form_data) && |
| 107 generation_upload_status == form.generation_upload_status && | 110 generation_upload_status == form.generation_upload_status && |
| 108 display_name == form.display_name && | 111 display_name == form.display_name && |
| 109 avatar_url == form.avatar_url && | 112 avatar_url == form.avatar_url && |
| 110 federation_url == form.federation_url && | 113 federation_url == form.federation_url && |
| 111 skip_zero_click == form.skip_zero_click && | 114 skip_zero_click == form.skip_zero_click && |
| 112 layout == form.layout; | 115 layout == form.layout && |
| 116 was_parsed_using_autofill_predictions == |
| 117 form.was_parsed_using_autofill_predictions; |
| 113 } | 118 } |
| 114 | 119 |
| 115 bool PasswordForm::operator!=(const PasswordForm& form) const { | 120 bool PasswordForm::operator!=(const PasswordForm& form) const { |
| 116 return !operator==(form); | 121 return !operator==(form); |
| 117 } | 122 } |
| 118 | 123 |
| 119 std::ostream& operator<<(std::ostream& os, PasswordForm::Layout layout) { | 124 std::ostream& operator<<(std::ostream& os, PasswordForm::Layout layout) { |
| 120 switch (layout) { | 125 switch (layout) { |
| 121 case PasswordForm::Layout::LAYOUT_OTHER: | 126 case PasswordForm::Layout::LAYOUT_OTHER: |
| 122 os << "LAYOUT_OTHER"; | 127 os << "LAYOUT_OTHER"; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 150 &form_json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &form_as_string); | 155 &form_json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &form_as_string); |
| 151 base::TrimWhitespaceASCII(form_as_string, base::TRIM_ALL, &form_as_string); | 156 base::TrimWhitespaceASCII(form_as_string, base::TRIM_ALL, &form_as_string); |
| 152 return os << "PasswordForm(" << form_as_string << ")"; | 157 return os << "PasswordForm(" << form_as_string << ")"; |
| 153 } | 158 } |
| 154 | 159 |
| 155 std::ostream& operator<<(std::ostream& os, PasswordForm* form) { | 160 std::ostream& operator<<(std::ostream& os, PasswordForm* form) { |
| 156 return os << "&" << *form; | 161 return os << "&" << *form; |
| 157 } | 162 } |
| 158 | 163 |
| 159 } // namespace autofill | 164 } // namespace autofill |
| OLD | NEW |