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

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

Issue 2859243004: Add metrics for PasswordForm submission types (Closed)
Patch Set: Test added 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..e62bcb93525df693853c2819cbd0339da944353b 100644
--- a/components/autofill/content/common/autofill_types_struct_traits.cc
+++ b/components/autofill/content/common/autofill_types_struct_traits.cc
@@ -242,6 +242,64 @@ bool EnumTraits<mojom::PasswordFormScheme, PasswordForm::Scheme>::FromMojom(
return false;
}
+// static
+mojom::PasswordFormSubmissionEvent
+EnumTraits<mojom::PasswordFormSubmissionEvent, PasswordForm::SubmissionEvent>::
+ ToMojom(PasswordForm::SubmissionEvent input) {
+ switch (input) {
+ case PasswordForm::SubmissionEvent::NONE:
+ return mojom::PasswordFormSubmissionEvent::NONE;
+ case PasswordForm::SubmissionEvent::HTML_FORM_SUBMISSION:
+ return mojom::PasswordFormSubmissionEvent::HTML_FORM_SUBMISSION;
+ case PasswordForm::SubmissionEvent::INPAGE_NAVIGATION:
+ return mojom::PasswordFormSubmissionEvent::INPAGE_NAVIGATION;
+ case PasswordForm::SubmissionEvent::XHR_SUCCEEDED:
+ return mojom::PasswordFormSubmissionEvent::XHR_SUCCEEDED;
+ case PasswordForm::SubmissionEvent::FRAME_DETACHED:
+ return mojom::PasswordFormSubmissionEvent::FRAME_DETACHED;
+ case PasswordForm::SubmissionEvent::BY_CONTEXT_MENU_CLICK:
+ return mojom::PasswordFormSubmissionEvent::BY_CONTEXT_MENU_CLICK;
+ case PasswordForm::SubmissionEvent::SUBMISSION_EVENT_COUNT:
+ return mojom::PasswordFormSubmissionEvent::SUBMISSION_EVENT_COUNT;
+ }
+
+ NOTREACHED();
+ return mojom::PasswordFormSubmissionEvent::NONE;
+}
+
+// static
+bool EnumTraits<mojom::PasswordFormSubmissionEvent,
+ PasswordForm::SubmissionEvent>::
+ FromMojom(mojom::PasswordFormSubmissionEvent input,
+ PasswordForm::SubmissionEvent* output) {
+ switch (input) {
+ case mojom::PasswordFormSubmissionEvent::NONE:
+ *output = PasswordForm::SubmissionEvent::NONE;
+ return true;
+ case mojom::PasswordFormSubmissionEvent::HTML_FORM_SUBMISSION:
+ *output = PasswordForm::SubmissionEvent::HTML_FORM_SUBMISSION;
+ return true;
+ case mojom::PasswordFormSubmissionEvent::INPAGE_NAVIGATION:
+ *output = PasswordForm::SubmissionEvent::INPAGE_NAVIGATION;
+ return true;
+ case mojom::PasswordFormSubmissionEvent::XHR_SUCCEEDED:
+ *output = PasswordForm::SubmissionEvent::XHR_SUCCEEDED;
+ return true;
+ case mojom::PasswordFormSubmissionEvent::FRAME_DETACHED:
+ *output = PasswordForm::SubmissionEvent::FRAME_DETACHED;
+ return true;
+ case mojom::PasswordFormSubmissionEvent::BY_CONTEXT_MENU_CLICK:
+ *output = PasswordForm::SubmissionEvent::BY_CONTEXT_MENU_CLICK;
+ return true;
+ case mojom::PasswordFormSubmissionEvent::SUBMISSION_EVENT_COUNT:
+ *output = PasswordForm::SubmissionEvent::SUBMISSION_EVENT_COUNT;
+ return true;
+ }
+
+ NOTREACHED();
+ return false;
+}
+
// static
mojom::PasswordFormFieldPredictionType EnumTraits<
mojom::PasswordFormFieldPredictionType,
@@ -446,7 +504,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