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

Unified Diff: components/autofill/content/common/autofill_types_struct_traits.cc

Issue 2859243004: Add metrics for PasswordForm submission types (Closed)
Patch Set: addressed reviewer comments Created 3 years, 7 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/common/autofill_types_struct_traits.cc
diff --git a/components/autofill/content/common/autofill_types_struct_traits.cc b/components/autofill/content/common/autofill_types_struct_traits.cc
index d63283688a4f14217d3befce57ca6dc4952e9df1..7a4b19a33fc1508926fae980f8e632e38ebef38f 100644
--- a/components/autofill/content/common/autofill_types_struct_traits.cc
+++ b/components/autofill/content/common/autofill_types_struct_traits.cc
@@ -242,6 +242,71 @@ bool EnumTraits<mojom::PasswordFormScheme, PasswordForm::Scheme>::FromMojom(
return false;
}
+// static
+mojom::PasswordFormSubmissionIndicatorEvent
+EnumTraits<mojom::PasswordFormSubmissionIndicatorEvent,
+ PasswordForm::SubmissionIndicatorEvent>::
+ ToMojom(PasswordForm::SubmissionIndicatorEvent input) {
+ switch (input) {
+ case PasswordForm::SubmissionIndicatorEvent::NONE:
+ return mojom::PasswordFormSubmissionIndicatorEvent::NONE;
+ case PasswordForm::SubmissionIndicatorEvent::HTML_FORM_SUBMISSION:
+ return mojom::PasswordFormSubmissionIndicatorEvent::HTML_FORM_SUBMISSION;
+ case PasswordForm::SubmissionIndicatorEvent::SAME_DOCUMENT_NAVIGATION:
+ return mojom::PasswordFormSubmissionIndicatorEvent::
+ SAME_DOCUMENT_NAVIGATION;
+ case PasswordForm::SubmissionIndicatorEvent::XHR_SUCCEEDED:
+ return mojom::PasswordFormSubmissionIndicatorEvent::XHR_SUCCEEDED;
+ case PasswordForm::SubmissionIndicatorEvent::FRAME_DETACHED:
+ return mojom::PasswordFormSubmissionIndicatorEvent::FRAME_DETACHED;
+ case PasswordForm::SubmissionIndicatorEvent::MANUAL_SAVE:
+ return mojom::PasswordFormSubmissionIndicatorEvent::MANUAL_SAVE;
+ case PasswordForm::SubmissionIndicatorEvent::
+ SUBMISSION_INDICATOR_EVENT_COUNT:
+ return mojom::PasswordFormSubmissionIndicatorEvent::
+ SUBMISSION_INDICATOR_EVENT_COUNT;
+ }
+
+ NOTREACHED();
+ return mojom::PasswordFormSubmissionIndicatorEvent::NONE;
+}
+
+// static
+bool EnumTraits<mojom::PasswordFormSubmissionIndicatorEvent,
+ PasswordForm::SubmissionIndicatorEvent>::
+ FromMojom(mojom::PasswordFormSubmissionIndicatorEvent input,
+ PasswordForm::SubmissionIndicatorEvent* output) {
+ switch (input) {
+ case mojom::PasswordFormSubmissionIndicatorEvent::NONE:
+ *output = PasswordForm::SubmissionIndicatorEvent::NONE;
+ return true;
+ case mojom::PasswordFormSubmissionIndicatorEvent::HTML_FORM_SUBMISSION:
+ *output = PasswordForm::SubmissionIndicatorEvent::HTML_FORM_SUBMISSION;
+ return true;
+ case mojom::PasswordFormSubmissionIndicatorEvent::SAME_DOCUMENT_NAVIGATION:
+ *output =
+ PasswordForm::SubmissionIndicatorEvent::SAME_DOCUMENT_NAVIGATION;
+ return true;
+ case mojom::PasswordFormSubmissionIndicatorEvent::XHR_SUCCEEDED:
+ *output = PasswordForm::SubmissionIndicatorEvent::XHR_SUCCEEDED;
+ return true;
+ case mojom::PasswordFormSubmissionIndicatorEvent::FRAME_DETACHED:
+ *output = PasswordForm::SubmissionIndicatorEvent::FRAME_DETACHED;
+ return true;
+ case mojom::PasswordFormSubmissionIndicatorEvent::MANUAL_SAVE:
+ *output = PasswordForm::SubmissionIndicatorEvent::MANUAL_SAVE;
+ return true;
+ case mojom::PasswordFormSubmissionIndicatorEvent::
+ SUBMISSION_INDICATOR_EVENT_COUNT:
+ *output = PasswordForm::SubmissionIndicatorEvent::
+ SUBMISSION_INDICATOR_EVENT_COUNT;
+ return true;
+ }
+
+ NOTREACHED();
+ return false;
+}
+
// static
mojom::PasswordFormFieldPredictionType EnumTraits<
mojom::PasswordFormFieldPredictionType,
@@ -446,7 +511,8 @@ bool StructTraits<mojom::PasswordFormDataView, PasswordForm>::Read(
!data.ReadAction(&out->action) ||
!data.ReadAffiliatedWebRealm(&out->affiliated_web_realm) ||
!data.ReadSubmitElement(&out->submit_element) ||
- !data.ReadUsernameElement(&out->username_element))
+ !data.ReadUsernameElement(&out->username_element) ||
+ !data.ReadSubmissionEvent(&out->submission_event))
return false;
out->username_marked_by_site = data.username_marked_by_site();

Powered by Google App Engine
This is Rietveld 408576698