| 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 |
| 99 // Adds or modifies a local credit card. If |jguid| is an empty string, we | 108 // Adds or modifies a local credit card. If |jguid| is an empty string, we |
| 100 // are creating a new card. Else we are updating an existing profile. Always | 109 // are creating a new card. Else we are updating an existing profile. Always |
| 101 // returns the GUID for this profile; the GUID it may have just been created. | 110 // returns the GUID for this profile; the GUID it may have just been created. |
| 102 base::android::ScopedJavaLocalRef<jstring> SetCreditCard( | 111 base::android::ScopedJavaLocalRef<jstring> SetCreditCard( |
| 103 JNIEnv* env, | 112 JNIEnv* env, |
| 104 const base::android::JavaParamRef<jobject>& unused_obj, | 113 const base::android::JavaParamRef<jobject>& unused_obj, |
| 105 const base::android::JavaParamRef<jobject>& jcard); | 114 const base::android::JavaParamRef<jobject>& jcard); |
| 106 | 115 |
| 107 // Updates the billing address of a server credit card with GUID |jguid|. | 116 // Updates the billing address of a server credit card with GUID |jguid|. |
| 108 void UpdateServerCardBillingAddress(JNIEnv* env, | 117 void UpdateServerCardBillingAddress( |
| 118 JNIEnv* env, |
| 109 const base::android::JavaParamRef<jobject>& unused_obj, | 119 const base::android::JavaParamRef<jobject>& unused_obj, |
| 110 const base::android::JavaParamRef<jstring>& jguid, | 120 const base::android::JavaParamRef<jstring>& jguid, |
| 111 const base::android::JavaParamRef<jstring>& jbilling_address_id); | 121 const base::android::JavaParamRef<jstring>& jbilling_address_id); |
| 112 | 122 |
| 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 |
| 113 // Adds a server credit card. Used only in tests. | 130 // Adds a server credit card. Used only in tests. |
| 114 void AddServerCreditCardForTest( | 131 void AddServerCreditCardForTest( |
| 115 JNIEnv* env, | 132 JNIEnv* env, |
| 116 const base::android::JavaParamRef<jobject>& unused_obj, | 133 const base::android::JavaParamRef<jobject>& unused_obj, |
| 117 const base::android::JavaParamRef<jobject>& jcard); | 134 const base::android::JavaParamRef<jobject>& jcard); |
| 118 | 135 |
| 119 // Removes the profile or credit card represented by |jguid|. | 136 // Removes the profile or credit card represented by |jguid|. |
| 120 void RemoveByGUID(JNIEnv* env, | 137 void RemoveByGUID(JNIEnv* env, |
| 121 const base::android::JavaParamRef<jobject>& unused_obj, | 138 const base::android::JavaParamRef<jobject>& unused_obj, |
| 122 const base::android::JavaParamRef<jstring>& jguid); | 139 const base::android::JavaParamRef<jstring>& jguid); |
| 123 | 140 |
| 124 // Resets the given unmasked card back to the masked state. | 141 // Resets the given unmasked card back to the masked state. |
| 125 void ClearUnmaskedCache( | 142 void ClearUnmaskedCache( |
| 126 JNIEnv* env, | 143 JNIEnv* env, |
| 127 const base::android::JavaParamRef<jobject>& unused_obj, | 144 const base::android::JavaParamRef<jobject>& unused_obj, |
| 128 const base::android::JavaParamRef<jstring>& jguid); | 145 const base::android::JavaParamRef<jstring>& jguid); |
| 129 | 146 |
| 130 // Gets the card CVC and unmasks the card (if it's masked). | 147 // Gets the card CVC and expiration date (if it's expired). If the card is |
| 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. |
| 131 void GetFullCardForPaymentRequest( | 152 void GetFullCardForPaymentRequest( |
| 132 JNIEnv* env, | 153 JNIEnv* env, |
| 133 const base::android::JavaParamRef<jobject>& unused_obj, | 154 const base::android::JavaParamRef<jobject>& unused_obj, |
| 134 const base::android::JavaParamRef<jobject>& jweb_contents, | 155 const base::android::JavaParamRef<jobject>& jweb_contents, |
| 135 const base::android::JavaParamRef<jstring>& jguid, | 156 const base::android::JavaParamRef<jstring>& jguid, |
| 136 const base::android::JavaParamRef<jobject>& jdelegate); | 157 const base::android::JavaParamRef<jobject>& jdelegate); |
| 137 | 158 |
| 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 |
| 138 // PersonalDataManagerObserver: | 176 // PersonalDataManagerObserver: |
| 139 void OnPersonalDataChanged() override; | 177 void OnPersonalDataChanged() override; |
| 140 | 178 |
| 141 // Registers the JNI bindings for this class. | 179 // Registers the JNI bindings for this class. |
| 142 static bool Register(JNIEnv* env); | 180 static bool Register(JNIEnv* env); |
| 143 | 181 |
| 144 // Sets the use count and use date of the profile associated to the |jguid|. | 182 // Sets the use count and use date of the profile associated to the |jguid|. |
| 145 // Both |count| and |date| should be non-negative. |date| represents an | 183 // Both |count| and |date| should be non-negative. |date| represents an |
| 146 // absolute point in coordinated universal time (UTC) represented as | 184 // absolute point in coordinated universal time (UTC) represented as |
| 147 // microseconds since the Windows epoch. For more details see the comment | 185 // microseconds since the Windows epoch. For more details see the comment |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 233 |
| 196 // Pointer to the PersonalDataManager for the main profile. | 234 // Pointer to the PersonalDataManager for the main profile. |
| 197 PersonalDataManager* personal_data_manager_; | 235 PersonalDataManager* personal_data_manager_; |
| 198 | 236 |
| 199 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid); | 237 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid); |
| 200 }; | 238 }; |
| 201 | 239 |
| 202 } // namespace autofill | 240 } // namespace autofill |
| 203 | 241 |
| 204 #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ | 242 #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ |
| OLD | NEW |