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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.autofill; 5 package org.chromium.chrome.browser.autofill;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 8
9 import org.chromium.base.ThreadUtils; 9 import org.chromium.base.ThreadUtils;
10 import org.chromium.base.VisibleForTesting; 10 import org.chromium.base.VisibleForTesting;
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 nativeGetFullCardForPaymentRequest( 630 nativeGetFullCardForPaymentRequest(
631 mPersonalDataManagerAndroid, webContents, guid, delegate); 631 mPersonalDataManagerAndroid, webContents, guid, delegate);
632 } 632 }
633 633
634 public void getFullTemporaryCard(WebContents webContents, String cardNumber, String nameOnCard, 634 public void getFullTemporaryCard(WebContents webContents, String cardNumber, String nameOnCard,
635 String expirationMonth, String expirationYear, FullCardRequestDelega te delegate) { 635 String expirationMonth, String expirationYear, FullCardRequestDelega te delegate) {
636 nativeGetFullTemporaryCardForPaymentRequest(mPersonalDataManagerAndroid, webContents, 636 nativeGetFullTemporaryCardForPaymentRequest(mPersonalDataManagerAndroid, webContents,
637 cardNumber, nameOnCard, expirationMonth, expirationYear, delegat e); 637 cardNumber, nameOnCard, expirationMonth, expirationYear, delegat e);
638 } 638 }
639 639
640 /**
641 * Records the use of the profile associated with the specified {@code guid} . Effectively
642 * increments the use count of the profile and sets its use date to the curr ent time. Also logs
643 * usage metrics.
644 *
645 * @param guid The GUID of the profile.
646 */
647 public void recordAndLogProfileUse(String guid) {
648 ThreadUtils.assertOnUiThread();
649 nativeRecordAndLogProfileUse(mPersonalDataManagerAndroid, guid);
650 }
651
640 @VisibleForTesting 652 @VisibleForTesting
641 protected void setProfileUseStatsForTesting(String guid, int count, long dat e) { 653 protected void setProfileUseStatsForTesting(String guid, int count, long dat e) {
642 ThreadUtils.assertOnUiThread(); 654 ThreadUtils.assertOnUiThread();
643 nativeSetProfileUseStatsForTesting(mPersonalDataManagerAndroid, guid, co unt, date); 655 nativeSetProfileUseStatsForTesting(mPersonalDataManagerAndroid, guid, co unt, date);
644 } 656 }
645 657
646 @VisibleForTesting 658 @VisibleForTesting
659 int getProfileUseCountForTesting(String guid) {
660 ThreadUtils.assertOnUiThread();
661 return nativeGetProfileUseCountForTesting(mPersonalDataManagerAndroid, g uid);
662 }
663
664 @VisibleForTesting
665 long getProfileUseDateForTesting(String guid) {
666 ThreadUtils.assertOnUiThread();
667 return nativeGetProfileUseDateForTesting(mPersonalDataManagerAndroid, gu id);
668 }
669
670 /**
671 * Records the use of the credit card associated with the specified {@code g uid}. Effectively
672 * increments the use count of the credit card and set its use date to the c urrent time. Also
673 * logs usage metrics.
674 *
675 * @param guid The GUID of the credit card.
676 */
677 public void recordAndLogCreditCardUse(String guid) {
678 ThreadUtils.assertOnUiThread();
679 nativeRecordAndLogCreditCardUse(mPersonalDataManagerAndroid, guid);
680 }
681
682 @VisibleForTesting
647 protected void setCreditCardUseStatsForTesting(String guid, int count, long date) { 683 protected void setCreditCardUseStatsForTesting(String guid, int count, long date) {
648 ThreadUtils.assertOnUiThread(); 684 ThreadUtils.assertOnUiThread();
649 nativeSetCreditCardUseStatsForTesting(mPersonalDataManagerAndroid, guid, count, date); 685 nativeSetCreditCardUseStatsForTesting(mPersonalDataManagerAndroid, guid, count, date);
650 } 686 }
651 687
688 @VisibleForTesting
689 int getCreditCardUseCountForTesting(String guid) {
690 ThreadUtils.assertOnUiThread();
691 return nativeGetCreditCardUseCountForTesting(mPersonalDataManagerAndroid , guid);
692 }
693
694 @VisibleForTesting
695 long getCreditCardUseDateForTesting(String guid) {
696 ThreadUtils.assertOnUiThread();
697 return nativeGetCreditCardUseDateForTesting(mPersonalDataManagerAndroid, guid);
698 }
699
700 @VisibleForTesting
701 long getCurrentDateForTesting() {
702 ThreadUtils.assertOnUiThread();
703 return nativeGetCurrentDateForTesting(mPersonalDataManagerAndroid);
704 }
705
652 /** 706 /**
653 * @return Whether the Autofill feature is enabled. 707 * @return Whether the Autofill feature is enabled.
654 */ 708 */
655 public static boolean isAutofillEnabled() { 709 public static boolean isAutofillEnabled() {
656 return nativeIsAutofillEnabled(); 710 return nativeIsAutofillEnabled();
657 } 711 }
658 712
659 /** 713 /**
660 * Enables or disables the Autofill feature. 714 * Enables or disables the Autofill feature.
661 * @param enable True to disable Autofill, false otherwise. 715 * @param enable True to disable Autofill, false otherwise.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
708 String cardNumber); 762 String cardNumber);
709 private native String nativeSetCreditCard(long nativePersonalDataManagerAndr oid, 763 private native String nativeSetCreditCard(long nativePersonalDataManagerAndr oid,
710 CreditCard card); 764 CreditCard card);
711 private native void nativeUpdateServerCardBillingAddress(long nativePersonal DataManagerAndroid, 765 private native void nativeUpdateServerCardBillingAddress(long nativePersonal DataManagerAndroid,
712 String guid, String billingAddressId); 766 String guid, String billingAddressId);
713 private native String nativeGetBasicCardPaymentTypeIfValid( 767 private native String nativeGetBasicCardPaymentTypeIfValid(
714 long nativePersonalDataManagerAndroid, String cardNumber); 768 long nativePersonalDataManagerAndroid, String cardNumber);
715 private native void nativeAddServerCreditCardForTest(long nativePersonalData ManagerAndroid, 769 private native void nativeAddServerCreditCardForTest(long nativePersonalData ManagerAndroid,
716 CreditCard card); 770 CreditCard card);
717 private native void nativeRemoveByGUID(long nativePersonalDataManagerAndroid , String guid); 771 private native void nativeRemoveByGUID(long nativePersonalDataManagerAndroid , String guid);
772 private native void nativeRecordAndLogProfileUse(long nativePersonalDataMana gerAndroid,
773 String guid);
718 private native void nativeSetProfileUseStatsForTesting( 774 private native void nativeSetProfileUseStatsForTesting(
719 long nativePersonalDataManagerAndroid, String guid, int count, long date); 775 long nativePersonalDataManagerAndroid, String guid, int count, long date);
776 private native int nativeGetProfileUseCountForTesting(long nativePersonalDat aManagerAndroid,
777 String guid);
778 private native long nativeGetProfileUseDateForTesting(long nativePersonalDat aManagerAndroid,
779 String guid);
780 private native void nativeRecordAndLogCreditCardUse(long nativePersonalDataM anagerAndroid,
781 String guid);
720 private native void nativeSetCreditCardUseStatsForTesting( 782 private native void nativeSetCreditCardUseStatsForTesting(
721 long nativePersonalDataManagerAndroid, String guid, int count, long date); 783 long nativePersonalDataManagerAndroid, String guid, int count, long date);
784 private native int nativeGetCreditCardUseCountForTesting(long nativePersonal DataManagerAndroid,
785 String guid);
786 private native long nativeGetCreditCardUseDateForTesting(long nativePersonal DataManagerAndroid,
787 String guid);
788 private native long nativeGetCurrentDateForTesting(long nativePersonalDataMa nagerAndroid);
722 private native void nativeClearUnmaskedCache( 789 private native void nativeClearUnmaskedCache(
723 long nativePersonalDataManagerAndroid, String guid); 790 long nativePersonalDataManagerAndroid, String guid);
724 private native void nativeGetFullCardForPaymentRequest(long nativePersonalDa taManagerAndroid, 791 private native void nativeGetFullCardForPaymentRequest(long nativePersonalDa taManagerAndroid,
725 WebContents webContents, String guid, FullCardRequestDelegate delega te); 792 WebContents webContents, String guid, FullCardRequestDelegate delega te);
726 private native void nativeGetFullTemporaryCardForPaymentRequest( 793 private native void nativeGetFullTemporaryCardForPaymentRequest(
727 long nativePersonalDataManagerAndroid, WebContents webContents, Stri ng cardNumber, 794 long nativePersonalDataManagerAndroid, WebContents webContents, Stri ng cardNumber,
728 String nameOnCard, String expirationMonth, String expirationYear, 795 String nameOnCard, String expirationMonth, String expirationYear,
729 FullCardRequestDelegate delegate); 796 FullCardRequestDelegate delegate);
730 private static native boolean nativeIsAutofillEnabled(); 797 private static native boolean nativeIsAutofillEnabled();
731 private static native void nativeSetAutofillEnabled(boolean enable); 798 private static native void nativeSetAutofillEnabled(boolean enable);
732 private static native boolean nativeIsAutofillManaged(); 799 private static native boolean nativeIsAutofillManaged();
733 private static native boolean nativeIsPaymentsIntegrationEnabled(); 800 private static native boolean nativeIsPaymentsIntegrationEnabled();
734 private static native void nativeSetPaymentsIntegrationEnabled(boolean enabl e); 801 private static native void nativeSetPaymentsIntegrationEnabled(boolean enabl e);
735 private static native String nativeToCountryCode(String countryName); 802 private static native String nativeToCountryCode(String countryName);
736 } 803 }
OLDNEW
« 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