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

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

Issue 2859243004: Add metrics for PasswordForm submission types (Closed)
Patch Set: rebase 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..519abde25eb00c3417861074f82c0fd35885b566 100644
--- a/components/autofill/content/common/autofill_types_struct_traits.cc
+++ b/components/autofill/content/common/autofill_types_struct_traits.cc
@@ -242,6 +242,66 @@ bool EnumTraits<mojom::PasswordFormScheme, PasswordForm::Scheme>::FromMojom(
return false;
}
+// static
+mojom::PasswordFormSubmissionIndicatorEvent
engedy 2017/05/10 13:07:42 ad-hoc musings: Can you please reassure me that th
dvadym 2017/05/10 14:09:25 No, I did it manually :). It took ~ 2 mins, writin
+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::INPAGE_NAVIGATION:
+ return mojom::PasswordFormSubmissionIndicatorEvent::INPAGE_NAVIGATION;
+ case PasswordForm::SubmissionIndicatorEvent::XHR_SUCCEEDED:
+ return mojom::PasswordFormSubmissionIndicatorEvent::XHR_SUCCEEDED;
+ case PasswordForm::SubmissionIndicatorEvent::FRAME_DETACHED:
+ return mojom::PasswordFormSubmissionIndicatorEvent::FRAME_DETACHED;
+ case PasswordForm::SubmissionIndicatorEvent::BY_CONTEXT_MENU_CLICK:
+ return mojom::PasswordFormSubmissionIndicatorEvent::BY_CONTEXT_MENU_CLICK;
+ case PasswordForm::SubmissionIndicatorEvent::SUBMISSION_EVENT_COUNT:
+ return mojom::PasswordFormSubmissionIndicatorEvent::
+ SUBMISSION_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::INPAGE_NAVIGATION:
+ *output = PasswordForm::SubmissionIndicatorEvent::INPAGE_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::BY_CONTEXT_MENU_CLICK:
+ *output = PasswordForm::SubmissionIndicatorEvent::BY_CONTEXT_MENU_CLICK;
+ return true;
+ case mojom::PasswordFormSubmissionIndicatorEvent::SUBMISSION_EVENT_COUNT:
+ *output = PasswordForm::SubmissionIndicatorEvent::SUBMISSION_EVENT_COUNT;
+ return true;
+ }
+
+ NOTREACHED();
+ return false;
+}
+
// static
mojom::PasswordFormFieldPredictionType EnumTraits<
mojom::PasswordFormFieldPredictionType,
@@ -446,7 +506,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