Index: components/autofill/content/public/cpp/autofill_types_struct_traits.cc |
diff --git a/components/autofill/content/public/cpp/autofill_types_struct_traits.cc b/components/autofill/content/public/cpp/autofill_types_struct_traits.cc |
index b61c11cb30c21fb2025e8aef94646cec04716728..3c5388860750b7b2d10664c88872cdf7609c9438 100644 |
--- a/components/autofill/content/public/cpp/autofill_types_struct_traits.cc |
+++ b/components/autofill/content/public/cpp/autofill_types_struct_traits.cc |
@@ -5,12 +5,15 @@ |
#include "components/autofill/content/public/cpp/autofill_types_struct_traits.h" |
#include "base/i18n/rtl.h" |
+#include "ipc/ipc_message_utils.h" |
+#include "url/mojo/origin_struct_traits.h" |
#include "url/mojo/url_gurl_struct_traits.h" |
using namespace autofill; |
namespace mojo { |
+// static |
mojom::CheckStatus |
EnumTraits<mojom::CheckStatus, FormFieldData::CheckStatus>::ToMojom( |
FormFieldData::CheckStatus input) { |
@@ -27,6 +30,7 @@ EnumTraits<mojom::CheckStatus, FormFieldData::CheckStatus>::ToMojom( |
return mojom::CheckStatus::NOT_CHECKABLE; |
} |
+// static |
bool EnumTraits<mojom::CheckStatus, FormFieldData::CheckStatus>::FromMojom( |
mojom::CheckStatus input, |
FormFieldData::CheckStatus* output) { |
@@ -46,6 +50,7 @@ bool EnumTraits<mojom::CheckStatus, FormFieldData::CheckStatus>::FromMojom( |
return false; |
} |
+// static |
mojom::RoleAttribute |
EnumTraits<mojom::RoleAttribute, FormFieldData::RoleAttribute>::ToMojom( |
FormFieldData::RoleAttribute input) { |
@@ -60,6 +65,7 @@ EnumTraits<mojom::RoleAttribute, FormFieldData::RoleAttribute>::ToMojom( |
return mojom::RoleAttribute::ROLE_ATTRIBUTE_OTHER; |
} |
+// static |
bool EnumTraits<mojom::RoleAttribute, FormFieldData::RoleAttribute>::FromMojom( |
mojom::RoleAttribute input, |
FormFieldData::RoleAttribute* output) { |
@@ -76,6 +82,7 @@ bool EnumTraits<mojom::RoleAttribute, FormFieldData::RoleAttribute>::FromMojom( |
return false; |
} |
+// static |
mojom::TextDirection |
EnumTraits<mojom::TextDirection, base::i18n::TextDirection>::ToMojom( |
base::i18n::TextDirection input) { |
@@ -94,6 +101,7 @@ EnumTraits<mojom::TextDirection, base::i18n::TextDirection>::ToMojom( |
return mojom::TextDirection::UNKNOWN_DIRECTION; |
} |
+// static |
bool EnumTraits<mojom::TextDirection, base::i18n::TextDirection>::FromMojom( |
mojom::TextDirection input, |
base::i18n::TextDirection* output) { |
@@ -117,6 +125,165 @@ bool EnumTraits<mojom::TextDirection, base::i18n::TextDirection>::FromMojom( |
} |
// static |
+mojom::GenerationUploadStatus EnumTraits<mojom::GenerationUploadStatus, |
+ PasswordForm::GenerationUploadStatus>:: |
+ ToMojom(PasswordForm::GenerationUploadStatus input) { |
+ switch (input) { |
+ case PasswordForm::GenerationUploadStatus::NO_SIGNAL_SENT: |
+ return mojom::GenerationUploadStatus::NO_SIGNAL_SENT; |
+ case PasswordForm::GenerationUploadStatus::POSITIVE_SIGNAL_SENT: |
+ return mojom::GenerationUploadStatus::POSITIVE_SIGNAL_SENT; |
+ case PasswordForm::GenerationUploadStatus::NEGATIVE_SIGNAL_SENT: |
+ return mojom::GenerationUploadStatus::NEGATIVE_SIGNAL_SENT; |
+ case PasswordForm::GenerationUploadStatus::UNKNOWN_STATUS: |
+ return mojom::GenerationUploadStatus::UNKNOWN_STATUS; |
+ } |
+ |
+ NOTREACHED(); |
+ return mojom::GenerationUploadStatus::UNKNOWN_STATUS; |
+} |
+ |
+// static |
+bool EnumTraits<mojom::GenerationUploadStatus, |
+ PasswordForm::GenerationUploadStatus>:: |
+ FromMojom(mojom::GenerationUploadStatus input, |
+ PasswordForm::GenerationUploadStatus* output) { |
+ switch (input) { |
+ case mojom::GenerationUploadStatus::NO_SIGNAL_SENT: |
+ *output = PasswordForm::GenerationUploadStatus::NO_SIGNAL_SENT; |
+ return true; |
+ case mojom::GenerationUploadStatus::POSITIVE_SIGNAL_SENT: |
+ *output = PasswordForm::GenerationUploadStatus::POSITIVE_SIGNAL_SENT; |
+ return true; |
+ case mojom::GenerationUploadStatus::NEGATIVE_SIGNAL_SENT: |
+ *output = PasswordForm::GenerationUploadStatus::NEGATIVE_SIGNAL_SENT; |
+ return true; |
+ case mojom::GenerationUploadStatus::UNKNOWN_STATUS: |
+ *output = PasswordForm::GenerationUploadStatus::UNKNOWN_STATUS; |
+ return true; |
+ } |
+ |
+ NOTREACHED(); |
+ return false; |
+} |
+ |
+// static |
+mojom::PasswordFormLayout |
+EnumTraits<mojom::PasswordFormLayout, PasswordForm::Layout>::ToMojom( |
+ PasswordForm::Layout input) { |
+ switch (input) { |
+ case PasswordForm::Layout::LAYOUT_OTHER: |
+ return mojom::PasswordFormLayout::LAYOUT_OTHER; |
+ case PasswordForm::Layout::LAYOUT_LOGIN_AND_SIGNUP: |
+ return mojom::PasswordFormLayout::LAYOUT_LOGIN_AND_SIGNUP; |
+ } |
+ |
+ NOTREACHED(); |
+ return mojom::PasswordFormLayout::LAYOUT_OTHER; |
+} |
+ |
+// static |
+bool EnumTraits<mojom::PasswordFormLayout, PasswordForm::Layout>::FromMojom( |
+ mojom::PasswordFormLayout input, |
+ PasswordForm::Layout* output) { |
+ switch (input) { |
+ case mojom::PasswordFormLayout::LAYOUT_OTHER: |
+ *output = PasswordForm::Layout::LAYOUT_OTHER; |
+ return true; |
+ case mojom::PasswordFormLayout::LAYOUT_LOGIN_AND_SIGNUP: |
+ *output = PasswordForm::Layout::LAYOUT_LOGIN_AND_SIGNUP; |
+ return true; |
+ } |
+ |
+ NOTREACHED(); |
+ return false; |
+} |
+ |
+// static |
+mojom::PasswordFormType |
+EnumTraits<mojom::PasswordFormType, PasswordForm::Type>::ToMojom( |
+ PasswordForm::Type input) { |
+ switch (input) { |
+ case PasswordForm::Type::TYPE_MANUAL: |
+ return mojom::PasswordFormType::TYPE_MANUAL; |
+ case PasswordForm::Type::TYPE_GENERATED: |
+ return mojom::PasswordFormType::TYPE_GENERATED; |
+ case PasswordForm::Type::TYPE_API: |
+ return mojom::PasswordFormType::TYPE_API; |
+ } |
+ |
+ NOTREACHED(); |
+ return mojom::PasswordFormType::TYPE_MANUAL; |
+} |
+ |
+// static |
+bool EnumTraits<mojom::PasswordFormType, PasswordForm::Type>::FromMojom( |
+ mojom::PasswordFormType input, |
+ PasswordForm::Type* output) { |
+ switch (input) { |
+ case mojom::PasswordFormType::TYPE_MANUAL: |
+ *output = PasswordForm::Type::TYPE_MANUAL; |
+ return true; |
+ case mojom::PasswordFormType::TYPE_GENERATED: |
+ *output = PasswordForm::Type::TYPE_GENERATED; |
+ return true; |
+ case mojom::PasswordFormType::TYPE_API: |
+ *output = PasswordForm::Type::TYPE_API; |
+ return true; |
+ } |
+ |
+ NOTREACHED(); |
+ return false; |
+} |
+ |
+// static |
+mojom::PasswordFormScheme |
+EnumTraits<mojom::PasswordFormScheme, PasswordForm::Scheme>::ToMojom( |
+ PasswordForm::Scheme input) { |
+ switch (input) { |
+ case PasswordForm::Scheme::SCHEME_HTML: |
+ return mojom::PasswordFormScheme::SCHEME_HTML; |
+ case PasswordForm::Scheme::SCHEME_BASIC: |
+ return mojom::PasswordFormScheme::SCHEME_BASIC; |
+ case PasswordForm::Scheme::SCHEME_DIGEST: |
+ return mojom::PasswordFormScheme::SCHEME_DIGEST; |
+ case PasswordForm::Scheme::SCHEME_OTHER: |
+ return mojom::PasswordFormScheme::SCHEME_OTHER; |
+ case PasswordForm::Scheme::SCHEME_USERNAME_ONLY: |
+ return mojom::PasswordFormScheme::SCHEME_USERNAME_ONLY; |
+ } |
+ |
+ NOTREACHED(); |
+ return mojom::PasswordFormScheme::SCHEME_OTHER; |
+} |
+ |
+// static |
+bool EnumTraits<mojom::PasswordFormScheme, PasswordForm::Scheme>::FromMojom( |
+ mojom::PasswordFormScheme input, |
+ PasswordForm::Scheme* output) { |
+ switch (input) { |
+ case mojom::PasswordFormScheme::SCHEME_HTML: |
+ *output = PasswordForm::Scheme::SCHEME_HTML; |
+ return true; |
+ case mojom::PasswordFormScheme::SCHEME_BASIC: |
+ *output = PasswordForm::Scheme::SCHEME_BASIC; |
+ return true; |
+ case mojom::PasswordFormScheme::SCHEME_DIGEST: |
+ *output = PasswordForm::Scheme::SCHEME_DIGEST; |
+ return true; |
+ case mojom::PasswordFormScheme::SCHEME_OTHER: |
+ *output = PasswordForm::Scheme::SCHEME_OTHER; |
+ return true; |
+ case mojom::PasswordFormScheme::SCHEME_USERNAME_ONLY: |
+ *output = PasswordForm::Scheme::SCHEME_USERNAME_ONLY; |
+ return true; |
+ } |
+ |
+ NOTREACHED(); |
+ return false; |
+} |
+ |
+// static |
bool StructTraits<mojom::FormFieldData, FormFieldData>::Read( |
mojom::FormFieldDataDataView data, |
FormFieldData* out) { |
@@ -288,4 +455,80 @@ bool StructTraits<mojom::PasswordFormFillData, PasswordFormFillData>::Read( |
return true; |
} |
+// static |
+bool StructTraits<mojom::PasswordFormGenerationData, |
+ PasswordFormGenerationData>:: |
+ Read(mojom::PasswordFormGenerationDataDataView data, |
+ PasswordFormGenerationData* out) { |
+ if (!data.ReadName(&out->name) || !data.ReadAction(&out->action) || |
+ !data.ReadGenerationField(&out->generation_field)) |
+ return false; |
+ |
+ return true; |
+} |
+ |
+// static |
+bool StructTraits<mojom::PasswordForm, PasswordForm>::Read( |
+ mojom::PasswordFormDataView data, |
+ PasswordForm* out) { |
+ if (!data.ReadScheme(&out->scheme) || |
+ !data.ReadSignonRealm(&out->signon_realm) || |
+ !data.ReadOriginWithPath(&out->origin) || |
+ !data.ReadAction(&out->action) || |
+ !data.ReadAffiliatedWebRealm(&out->affiliated_web_realm) || |
+ !data.ReadSubmitElement(&out->submit_element) || |
+ !data.ReadUsernameElement(&out->username_element)) |
+ return false; |
+ |
+ out->username_marked_by_site = data.username_marked_by_site(); |
+ |
+ if (!data.ReadUsernameValue(&out->username_value) || |
+ !data.ReadOtherPossibleUsernames(&out->other_possible_usernames) || |
+ !data.ReadPasswordElement(&out->password_element) || |
+ !data.ReadPasswordValue(&out->password_value)) |
+ return false; |
+ |
+ out->password_value_is_default = data.password_value_is_default(); |
+ |
+ if (!data.ReadNewPasswordElement(&out->new_password_element) || |
+ !data.ReadNewPasswordValue(&out->new_password_value)) |
+ return false; |
+ |
+ out->new_password_value_is_default = data.new_password_value_is_default(); |
+ out->new_password_marked_by_site = data.new_password_marked_by_site(); |
+ out->ssl_valid = data.ssl_valid(); |
+ out->preferred = data.preferred(); |
+ |
+ if (!data.ReadDateCreated(&out->date_created) || |
+ !data.ReadDateSynced(&out->date_synced)) |
+ return false; |
+ |
+ out->blacklisted_by_user = data.blacklisted_by_user(); |
+ |
+ if (!data.ReadType(&out->type)) |
+ return false; |
+ |
+ out->times_used = data.times_used(); |
+ |
+ if (!data.ReadFormData(&out->form_data) || |
+ !data.ReadGenerationUploadStatus(&out->generation_upload_status) || |
+ !data.ReadDisplayName(&out->display_name) || |
+ !data.ReadIconUrl(&out->icon_url) || |
+ !data.ReadFederationOrigin(&out->federation_origin)) |
+ return false; |
+ |
+ out->skip_zero_click = data.skip_zero_click(); |
+ |
+ if (!data.ReadLayout(&out->layout)) |
+ return false; |
+ |
+ out->was_parsed_using_autofill_predictions = |
+ data.was_parsed_using_autofill_predictions(); |
+ out->is_public_suffix_match = data.is_public_suffix_match(); |
+ out->is_affiliation_based_match = data.is_affiliation_based_match(); |
+ out->does_look_like_signup_form = data.does_look_like_signup_form(); |
+ |
+ return true; |
+} |
+ |
} // namespace mojo |