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

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: Removed newlines 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/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 85dec0b2e464130597040576d761f3520b07866e..305a21adedb42638a6b4027afc7866e580366e72 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
@@ -636,6 +636,18 @@ public class PersonalDataManager {
mPersonalDataManagerAndroid, webContents, guid, delegate);
}
+ /**
+ * Records the use of the profile associated with the specified |guid|. Effectively increments
Bernhard Bauer 2016/07/14 10:14:19 I think variable names in Javadoc should be {@code
sebsg 2016/07/20 14:56:47 Done.
+ * 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();
@@ -643,11 +655,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 |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.
*/
@@ -710,10 +764,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,

Powered by Google App Engine
This is Rietveld 408576698