Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: components/autofill/content/public/cpp/autofill_types_struct_traits.h

Issue 2101533002: [Autofill] Add typemap for PasswordForm and PasswordFormGenerationData. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: origin --> origin_with_path Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/autofill/content/public/cpp/autofill_types_struct_traits.h
diff --git a/components/autofill/content/public/cpp/autofill_types_struct_traits.h b/components/autofill/content/public/cpp/autofill_types_struct_traits.h
index 7307b00d5e044eb42dc668f16f23e2dc5a666903..538a7bef29262e6d1d5535562b0ee3d740938704 100644
--- a/components/autofill/content/public/cpp/autofill_types_struct_traits.h
+++ b/components/autofill/content/public/cpp/autofill_types_struct_traits.h
@@ -13,7 +13,9 @@
#include "components/autofill/core/common/form_data_predictions.h"
#include "components/autofill/core/common/form_field_data.h"
#include "components/autofill/core/common/form_field_data_predictions.h"
+#include "components/autofill/core/common/password_form.h"
#include "components/autofill/core/common/password_form_fill_data.h"
+#include "components/autofill/core/common/password_form_generation_data.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
namespace mojo {
@@ -45,6 +47,42 @@ struct EnumTraits<autofill::mojom::TextDirection, base::i18n::TextDirection> {
};
template <>
+struct EnumTraits<autofill::mojom::GenerationUploadStatus,
+ autofill::PasswordForm::GenerationUploadStatus> {
+ static autofill::mojom::GenerationUploadStatus ToMojom(
+ autofill::PasswordForm::GenerationUploadStatus input);
+ static bool FromMojom(autofill::mojom::GenerationUploadStatus input,
+ autofill::PasswordForm::GenerationUploadStatus* output);
+};
+
+template <>
+struct EnumTraits<autofill::mojom::PasswordFormLayout,
+ autofill::PasswordForm::Layout> {
+ static autofill::mojom::PasswordFormLayout ToMojom(
+ autofill::PasswordForm::Layout input);
+ static bool FromMojom(autofill::mojom::PasswordFormLayout input,
+ autofill::PasswordForm::Layout* output);
+};
+
+template <>
+struct EnumTraits<autofill::mojom::PasswordFormType,
+ autofill::PasswordForm::Type> {
+ static autofill::mojom::PasswordFormType ToMojom(
+ autofill::PasswordForm::Type input);
+ static bool FromMojom(autofill::mojom::PasswordFormType input,
+ autofill::PasswordForm::Type* output);
+};
+
+template <>
+struct EnumTraits<autofill::mojom::PasswordFormScheme,
+ autofill::PasswordForm::Scheme> {
+ static autofill::mojom::PasswordFormScheme ToMojom(
+ autofill::PasswordForm::Scheme input);
+ static bool FromMojom(autofill::mojom::PasswordFormScheme input,
+ autofill::PasswordForm::Scheme* output);
+};
+
+template <>
struct StructTraits<autofill::mojom::FormFieldData, autofill::FormFieldData> {
static const base::string16& label(const autofill::FormFieldData& r) {
return r.label;
@@ -305,6 +343,179 @@ struct StructTraits<autofill::mojom::PasswordFormFillData,
autofill::PasswordFormFillData* out);
};
+template <>
+struct StructTraits<autofill::mojom::PasswordFormGenerationData,
+ autofill::PasswordFormGenerationData> {
+ static const base::string16& name(
+ const autofill::PasswordFormGenerationData& r) {
+ return r.name;
+ }
+
+ static const GURL& action(const autofill::PasswordFormGenerationData& r) {
+ return r.action;
+ }
+
+ static const autofill::FormFieldData& generation_field(
+ const autofill::PasswordFormGenerationData& r) {
+ return r.generation_field;
+ }
+
+ static bool Read(autofill::mojom::PasswordFormGenerationDataDataView data,
+ autofill::PasswordFormGenerationData* out);
+};
+
+template <>
+struct StructTraits<autofill::mojom::PasswordForm, autofill::PasswordForm> {
+ static autofill::PasswordForm::Scheme scheme(
+ const autofill::PasswordForm& r) {
+ return r.scheme;
+ }
+
+ static const std::string& signon_realm(const autofill::PasswordForm& r) {
+ return r.signon_realm;
+ }
+
+ static const GURL& origin_with_path(const autofill::PasswordForm& r) {
+ return r.origin;
+ }
+
+ static const GURL& action(const autofill::PasswordForm& r) {
+ return r.action;
+ }
+
+ static const std::string& affiliated_web_realm(
+ const autofill::PasswordForm& r) {
+ return r.affiliated_web_realm;
+ }
+
+ static const base::string16& submit_element(const autofill::PasswordForm& r) {
+ return r.submit_element;
+ }
+
+ static const base::string16& username_element(
+ const autofill::PasswordForm& r) {
+ return r.username_element;
+ }
+
+ static bool username_marked_by_site(const autofill::PasswordForm& r) {
+ return r.username_marked_by_site;
+ }
+
+ static const base::string16& username_value(const autofill::PasswordForm& r) {
+ return r.username_value;
+ }
+
+ static const std::vector<base::string16>& other_possible_usernames(
+ const autofill::PasswordForm& r) {
+ return r.other_possible_usernames;
+ }
+
+ static const base::string16& password_element(
+ const autofill::PasswordForm& r) {
+ return r.password_element;
+ }
+
+ static const base::string16& password_value(const autofill::PasswordForm& r) {
+ return r.password_value;
+ }
+
+ static bool password_value_is_default(const autofill::PasswordForm& r) {
+ return r.password_value_is_default;
+ }
+
+ static const base::string16& new_password_element(
+ const autofill::PasswordForm& r) {
+ return r.new_password_element;
+ }
+
+ static const base::string16& new_password_value(
+ const autofill::PasswordForm& r) {
+ return r.new_password_value;
+ }
+
+ static bool new_password_value_is_default(const autofill::PasswordForm& r) {
+ return r.new_password_value_is_default;
+ }
+
+ static bool new_password_marked_by_site(const autofill::PasswordForm& r) {
+ return r.new_password_marked_by_site;
+ }
+
+ static bool ssl_valid(const autofill::PasswordForm& r) { return r.ssl_valid; }
+
+ static bool preferred(const autofill::PasswordForm& r) { return r.preferred; }
+
+ static const base::Time& date_created(const autofill::PasswordForm& r) {
+ return r.date_created;
+ }
+
+ static const base::Time& date_synced(const autofill::PasswordForm& r) {
+ return r.date_synced;
+ }
+
+ static bool blacklisted_by_user(const autofill::PasswordForm& r) {
+ return r.blacklisted_by_user;
+ }
+
+ static autofill::PasswordForm::Type type(const autofill::PasswordForm& r) {
+ return r.type;
+ }
+
+ static int32_t times_used(const autofill::PasswordForm& r) {
+ return r.times_used;
+ }
+
+ static const autofill::FormData& form_data(const autofill::PasswordForm& r) {
+ return r.form_data;
+ }
+
+ static autofill::PasswordForm::GenerationUploadStatus
+ generation_upload_status(const autofill::PasswordForm& r) {
+ return r.generation_upload_status;
+ }
+
+ static const base::string16& display_name(const autofill::PasswordForm& r) {
+ return r.display_name;
+ }
+
+ static const GURL& icon_url(const autofill::PasswordForm& r) {
+ return r.icon_url;
+ }
+
+ static const url::Origin& federation_origin(const autofill::PasswordForm& r) {
+ return r.federation_origin;
+ }
+
+ static bool skip_zero_click(const autofill::PasswordForm& r) {
+ return r.skip_zero_click;
+ }
+
+ static autofill::PasswordForm::Layout layout(
+ const autofill::PasswordForm& r) {
+ return r.layout;
+ }
+
+ static bool was_parsed_using_autofill_predictions(
+ const autofill::PasswordForm& r) {
+ return r.was_parsed_using_autofill_predictions;
+ }
+
+ static bool is_public_suffix_match(const autofill::PasswordForm& r) {
+ return r.is_public_suffix_match;
+ }
+
+ static bool is_affiliation_based_match(const autofill::PasswordForm& r) {
+ return r.is_affiliation_based_match;
+ }
+
+ static bool does_look_like_signup_form(const autofill::PasswordForm& r) {
+ return r.does_look_like_signup_form;
+ }
+
+ static bool Read(autofill::mojom::PasswordFormDataView data,
+ autofill::PasswordForm* out);
+};
+
} // namespace mojo
#endif // COMPONENTS_AUTOFILL_CONTENT_PUBLIC_INTERFACES_AUTOFILL_TYPES_STRUCT_TRAITS_H_

Powered by Google App Engine
This is Rietveld 408576698