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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestMetrics.java

Issue 2182123003: [Payments] Add information requested by merchant metrics to PR. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestMetrics.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestMetrics.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestMetrics.java
new file mode 100644
index 0000000000000000000000000000000000000000..0d312e99502576161ec3883bf53e8e2a4f43e8f2
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestMetrics.java
@@ -0,0 +1,47 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.chrome.browser.payments;
+
+import org.chromium.base.VisibleForTesting;
+import org.chromium.base.metrics.RecordHistogram;
+
+/**
+ * A class used to record metrics for the Payment Request feature.
+ */
+public final class PaymentRequestMetrics {
+
+ // PaymentRequestRequestedInformation defined in tools/metrics/histograms/histograms.xml.
+ @VisibleForTesting
+ public static final int REQUESTED_INFORMATION_NONE = 0;
+ @VisibleForTesting
+ public static final int REQUESTED_INFORMATION_EMAIL = 1 << 0;
+ @VisibleForTesting
+ public static final int REQUESTED_INFORMATION_PHONE = 1 << 1;
+ @VisibleForTesting
+ public static final int REQUESTED_INFORMATION_SHIPPING = 1 << 2;
+ @VisibleForTesting
+ public static final int REQUESTED_INFORMATION_MAX = 8;
+
+ // There should be no instance of PaymentRequestMetrics created.
+ private PaymentRequestMetrics() {}
+
+ /*
+ * Records the metric that keeps track of what user information are requested by merchants to
+ * complete a payment request.
+ *
+ * @param requestEmail Whether the merchant requested an email address.
+ * @param requestPhone Whether the merchant requested a phone number.
+ * @param requestShipping Whether the merchant requested a shipping address.
+ */
+ public static void recordRequestedInformationHistogram(boolean requestEmail,
+ boolean requestPhone, boolean requestShipping) {
+ int requestInformation =
+ (requestEmail ? REQUESTED_INFORMATION_EMAIL : 0)
+ | (requestPhone ? REQUESTED_INFORMATION_PHONE : 0)
+ | (requestShipping ? REQUESTED_INFORMATION_SHIPPING : 0);
+ RecordHistogram.recordEnumeratedHistogram("PaymentRequest.RequestedInformation",
+ requestInformation, REQUESTED_INFORMATION_MAX);
+ }
+}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java ('k') | chrome/android/java_sources.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698