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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/autofill/PersonalDataManager.java

Issue 2126213002: [Payments] Record use of profiles and credit cards in Payment Request. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed temp card bug + nits 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/autofill/PersonalDataManager.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/PersonalDataManager.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/PersonalDataManager.java
index 8fae08fd55c4afe2661b27d80848810ec2778320..d463c388b09258774168922bec4dd50c88b64c28 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/PersonalDataManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/PersonalDataManager.java
@@ -637,6 +637,18 @@ public class PersonalDataManager {
cardNumber, nameOnCard, expirationMonth, expirationYear, delegate);
}
+ /**
+ * Records the use of the profile associated with the specified {@code guid}. Effectively
+ * increments the use count of the profile and sets its use date to the current time. Also logs
+ * usage metrics.
+ *
+ * @param guid The GUID of the profile.
+ */
+ public void recordAndLogProfileUse(String guid) {
+ ThreadUtils.assertOnUiThread();
+ nativeRecordAndLogProfileUse(mPersonalDataManagerAndroid, guid);
+ }
+
@VisibleForTesting
protected void setProfileUseStatsForTesting(String guid, int count, long date) {
ThreadUtils.assertOnUiThread();
@@ -644,11 +656,53 @@ public class PersonalDataManager {
}
@VisibleForTesting
+ int getProfileUseCountForTesting(String guid) {
+ ThreadUtils.assertOnUiThread();
+ return nativeGetProfileUseCountForTesting(mPersonalDataManagerAndroid, guid);
+ }
+
+ @VisibleForTesting
+ long getProfileUseDateForTesting(String guid) {
+ ThreadUtils.assertOnUiThread();
+ return nativeGetProfileUseDateForTesting(mPersonalDataManagerAndroid, guid);
+ }
+
+ /**
+ * Records the use of the credit card associated with the specified {@code guid}. Effectively
+ * increments the use count of the credit card and set its use date to the current time. Also
+ * logs usage metrics.
+ *
+ * @param guid The GUID of the credit card.
+ */
+ public void recordAndLogCreditCardUse(String guid) {
+ ThreadUtils.assertOnUiThread();
+ nativeRecordAndLogCreditCardUse(mPersonalDataManagerAndroid, guid);
+ }
+
+ @VisibleForTesting
protected void setCreditCardUseStatsForTesting(String guid, int count, long date) {
ThreadUtils.assertOnUiThread();
nativeSetCreditCardUseStatsForTesting(mPersonalDataManagerAndroid, guid, count, date);
}
+ @VisibleForTesting
+ int getCreditCardUseCountForTesting(String guid) {
+ ThreadUtils.assertOnUiThread();
+ return nativeGetCreditCardUseCountForTesting(mPersonalDataManagerAndroid, guid);
+ }
+
+ @VisibleForTesting
+ long getCreditCardUseDateForTesting(String guid) {
+ ThreadUtils.assertOnUiThread();
+ return nativeGetCreditCardUseDateForTesting(mPersonalDataManagerAndroid, guid);
+ }
+
+ @VisibleForTesting
+ long getCurrentDateForTesting() {
+ ThreadUtils.assertOnUiThread();
+ return nativeGetCurrentDateForTesting(mPersonalDataManagerAndroid);
+ }
+
/**
* @return Whether the Autofill feature is enabled.
*/
@@ -715,10 +769,23 @@ public class PersonalDataManager {
private native void nativeAddServerCreditCardForTest(long nativePersonalDataManagerAndroid,
CreditCard card);
private native void nativeRemoveByGUID(long nativePersonalDataManagerAndroid, String guid);
+ private native void nativeRecordAndLogProfileUse(long nativePersonalDataManagerAndroid,
+ String guid);
private native void nativeSetProfileUseStatsForTesting(
long nativePersonalDataManagerAndroid, String guid, int count, long date);
+ private native int nativeGetProfileUseCountForTesting(long nativePersonalDataManagerAndroid,
+ String guid);
+ private native long nativeGetProfileUseDateForTesting(long nativePersonalDataManagerAndroid,
+ String guid);
+ private native void nativeRecordAndLogCreditCardUse(long nativePersonalDataManagerAndroid,
+ String guid);
private native void nativeSetCreditCardUseStatsForTesting(
long nativePersonalDataManagerAndroid, String guid, int count, long date);
+ private native int nativeGetCreditCardUseCountForTesting(long nativePersonalDataManagerAndroid,
+ String guid);
+ private native long nativeGetCreditCardUseDateForTesting(long nativePersonalDataManagerAndroid,
+ String guid);
+ private native long nativeGetCurrentDateForTesting(long nativePersonalDataManagerAndroid);
private native void nativeClearUnmaskedCache(
long nativePersonalDataManagerAndroid, String guid);
private native void nativeGetFullCardForPaymentRequest(long nativePersonalDataManagerAndroid,
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698