| OLD | NEW |
| 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 #ifndef CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ | 6 #define CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ |
| 7 | 7 |
| 8 #include "base/android/jni_weak_ref.h" | 8 #include "base/android/jni_weak_ref.h" |
| 9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 JNIEnv* env, | 89 JNIEnv* env, |
| 90 const base::android::JavaParamRef<jobject>& unused_obj); | 90 const base::android::JavaParamRef<jobject>& unused_obj); |
| 91 | 91 |
| 92 // Returns the credit card with the specified |jguid|, or NULL if there is | 92 // Returns the credit card with the specified |jguid|, or NULL if there is |
| 93 // no credit card with the specified |jguid|. | 93 // no credit card with the specified |jguid|. |
| 94 base::android::ScopedJavaLocalRef<jobject> GetCreditCardByGUID( | 94 base::android::ScopedJavaLocalRef<jobject> GetCreditCardByGUID( |
| 95 JNIEnv* env, | 95 JNIEnv* env, |
| 96 const base::android::JavaParamRef<jobject>& unused_obj, | 96 const base::android::JavaParamRef<jobject>& unused_obj, |
| 97 const base::android::JavaParamRef<jstring>& jguid); | 97 const base::android::JavaParamRef<jstring>& jguid); |
| 98 | 98 |
| 99 // Returns a credit card with the specified |jcard_number|. This is used for | |
| 100 // determining the card's obfuscated number, issuer icon, and type in one go. | |
| 101 // This function does not interact with the autofill table on disk, so can be | |
| 102 // used for cards that are not saved. | |
| 103 base::android::ScopedJavaLocalRef<jobject> GetCreditCardForNumber( | |
| 104 JNIEnv* env, | |
| 105 const base::android::JavaParamRef<jobject>& unused_obj, | |
| 106 const base::android::JavaParamRef<jstring>& jcard_number); | |
| 107 | |
| 108 // Adds or modifies a local credit card. If |jguid| is an empty string, we | 99 // Adds or modifies a local credit card. If |jguid| is an empty string, we |
| 109 // are creating a new card. Else we are updating an existing profile. Always | 100 // are creating a new card. Else we are updating an existing profile. Always |
| 110 // returns the GUID for this profile; the GUID it may have just been created. | 101 // returns the GUID for this profile; the GUID it may have just been created. |
| 111 base::android::ScopedJavaLocalRef<jstring> SetCreditCard( | 102 base::android::ScopedJavaLocalRef<jstring> SetCreditCard( |
| 112 JNIEnv* env, | 103 JNIEnv* env, |
| 113 const base::android::JavaParamRef<jobject>& unused_obj, | 104 const base::android::JavaParamRef<jobject>& unused_obj, |
| 114 const base::android::JavaParamRef<jobject>& jcard); | 105 const base::android::JavaParamRef<jobject>& jcard); |
| 115 | 106 |
| 116 // Updates the billing address of a server credit card with GUID |jguid|. | 107 // Updates the billing address of a server credit card with GUID |jguid|. |
| 117 void UpdateServerCardBillingAddress( | 108 void UpdateServerCardBillingAddress(JNIEnv* env, |
| 118 JNIEnv* env, | |
| 119 const base::android::JavaParamRef<jobject>& unused_obj, | 109 const base::android::JavaParamRef<jobject>& unused_obj, |
| 120 const base::android::JavaParamRef<jstring>& jguid, | 110 const base::android::JavaParamRef<jstring>& jguid, |
| 121 const base::android::JavaParamRef<jstring>& jbilling_address_id); | 111 const base::android::JavaParamRef<jstring>& jbilling_address_id); |
| 122 | 112 |
| 123 // Returns the card type according to PaymentRequest spec, or an empty string | |
| 124 // if the given card number is not valid. | |
| 125 base::android::ScopedJavaLocalRef<jstring> GetBasicCardPaymentTypeIfValid( | |
| 126 JNIEnv* env, | |
| 127 const base::android::JavaParamRef<jobject>& unused_obj, | |
| 128 const base::android::JavaParamRef<jstring>& jcard_number); | |
| 129 | |
| 130 // Adds a server credit card. Used only in tests. | 113 // Adds a server credit card. Used only in tests. |
| 131 void AddServerCreditCardForTest( | 114 void AddServerCreditCardForTest( |
| 132 JNIEnv* env, | 115 JNIEnv* env, |
| 133 const base::android::JavaParamRef<jobject>& unused_obj, | 116 const base::android::JavaParamRef<jobject>& unused_obj, |
| 134 const base::android::JavaParamRef<jobject>& jcard); | 117 const base::android::JavaParamRef<jobject>& jcard); |
| 135 | 118 |
| 136 // Removes the profile or credit card represented by |jguid|. | 119 // Removes the profile or credit card represented by |jguid|. |
| 137 void RemoveByGUID(JNIEnv* env, | 120 void RemoveByGUID(JNIEnv* env, |
| 138 const base::android::JavaParamRef<jobject>& unused_obj, | 121 const base::android::JavaParamRef<jobject>& unused_obj, |
| 139 const base::android::JavaParamRef<jstring>& jguid); | 122 const base::android::JavaParamRef<jstring>& jguid); |
| 140 | 123 |
| 141 // Resets the given unmasked card back to the masked state. | 124 // Resets the given unmasked card back to the masked state. |
| 142 void ClearUnmaskedCache( | 125 void ClearUnmaskedCache( |
| 143 JNIEnv* env, | 126 JNIEnv* env, |
| 144 const base::android::JavaParamRef<jobject>& unused_obj, | 127 const base::android::JavaParamRef<jobject>& unused_obj, |
| 145 const base::android::JavaParamRef<jstring>& jguid); | 128 const base::android::JavaParamRef<jstring>& jguid); |
| 146 | 129 |
| 147 // Gets the card CVC and expiration date (if it's expired). If the card is | 130 // Gets the card CVC and unmasks the card (if it's masked). |
| 148 // masked, unmasks it. If the user has entered new expiration date, the new | |
| 149 // date is saved on disk. | |
| 150 // | |
| 151 // The full card details are sent to the delegate. | |
| 152 void GetFullCardForPaymentRequest( | 131 void GetFullCardForPaymentRequest( |
| 153 JNIEnv* env, | 132 JNIEnv* env, |
| 154 const base::android::JavaParamRef<jobject>& unused_obj, | 133 const base::android::JavaParamRef<jobject>& unused_obj, |
| 155 const base::android::JavaParamRef<jobject>& jweb_contents, | 134 const base::android::JavaParamRef<jobject>& jweb_contents, |
| 156 const base::android::JavaParamRef<jstring>& jguid, | 135 const base::android::JavaParamRef<jstring>& jguid, |
| 157 const base::android::JavaParamRef<jobject>& jdelegate); | 136 const base::android::JavaParamRef<jobject>& jdelegate); |
| 158 | 137 |
| 159 // Gets the card CVC and expiration date (if it's expired) for a card that's | |
| 160 // temporary and not stored on disk. No unmasking is performed. If the user | |
| 161 // has entered new expiration date, the new date is not saved on disk, because | |
| 162 // this card is temporary. | |
| 163 // | |
| 164 // The card number, name on card, and expiration date are used for UI display | |
| 165 // and are sent to the delegate after user confirms their CVC. | |
| 166 void GetFullTemporaryCardForPaymentRequest( | |
| 167 JNIEnv* env, | |
| 168 const base::android::JavaParamRef<jobject>& unused_obj, | |
| 169 const base::android::JavaParamRef<jobject>& jweb_contents, | |
| 170 const base::android::JavaParamRef<jstring>& jcard_number, | |
| 171 const base::android::JavaParamRef<jstring>& jname_on_card, | |
| 172 const base::android::JavaParamRef<jstring>& jexpiration_month, | |
| 173 const base::android::JavaParamRef<jstring>& jexpiration_year, | |
| 174 const base::android::JavaParamRef<jobject>& jdelegate); | |
| 175 | |
| 176 // PersonalDataManagerObserver: | 138 // PersonalDataManagerObserver: |
| 177 void OnPersonalDataChanged() override; | 139 void OnPersonalDataChanged() override; |
| 178 | 140 |
| 179 // Registers the JNI bindings for this class. | 141 // Registers the JNI bindings for this class. |
| 180 static bool Register(JNIEnv* env); | 142 static bool Register(JNIEnv* env); |
| 181 | 143 |
| 182 // Sets the use count and use date of the profile associated to the |jguid|. | 144 // Sets the use count and use date of the profile associated to the |jguid|. |
| 183 // Both |count| and |date| should be non-negative. |date| represents an | 145 // Both |count| and |date| should be non-negative. |date| represents an |
| 184 // absolute point in coordinated universal time (UTC) represented as | 146 // absolute point in coordinated universal time (UTC) represented as |
| 185 // microseconds since the Windows epoch. For more details see the comment | 147 // microseconds since the Windows epoch. For more details see the comment |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 | 195 |
| 234 // Pointer to the PersonalDataManager for the main profile. | 196 // Pointer to the PersonalDataManager for the main profile. |
| 235 PersonalDataManager* personal_data_manager_; | 197 PersonalDataManager* personal_data_manager_; |
| 236 | 198 |
| 237 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid); | 199 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid); |
| 238 }; | 200 }; |
| 239 | 201 |
| 240 } // namespace autofill | 202 } // namespace autofill |
| 241 | 203 |
| 242 #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ | 204 #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ |
| OLD | NEW |