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" |
| 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/strings/string16.h" |
| 13 #include "components/autofill/core/browser/payments/full_card_request.h" |
11 #include "components/autofill/core/browser/personal_data_manager.h" | 14 #include "components/autofill/core/browser/personal_data_manager.h" |
12 #include "components/autofill/core/browser/personal_data_manager_observer.h" | 15 #include "components/autofill/core/browser/personal_data_manager_observer.h" |
13 | 16 |
14 namespace autofill { | 17 namespace autofill { |
15 | 18 |
| 19 class CreditCard; |
| 20 |
16 // Android wrapper of the PersonalDataManager which provides access from the | 21 // Android wrapper of the PersonalDataManager which provides access from the |
17 // Java layer. Note that on Android, there's only a single profile, and | 22 // Java layer. Note that on Android, there's only a single profile, and |
18 // therefore a single instance of this wrapper. | 23 // therefore a single instance of this wrapper. |
19 class PersonalDataManagerAndroid : public PersonalDataManagerObserver { | 24 class PersonalDataManagerAndroid : public PersonalDataManagerObserver, |
| 25 public payments::FullCardRequest::Delegate { |
20 public: | 26 public: |
21 PersonalDataManagerAndroid(JNIEnv* env, jobject obj); | 27 PersonalDataManagerAndroid(JNIEnv* env, jobject obj); |
22 | 28 |
23 // These functions act on "web profiles" aka "LOCAL_PROFILE" profiles. | 29 // These functions act on "web profiles" aka "LOCAL_PROFILE" profiles. |
24 // ------------------------- | 30 // ------------------------- |
25 | 31 |
26 // Returns the number of web and auxiliary profiles. | 32 // Returns the number of web and auxiliary profiles. |
27 jint GetProfileCount(JNIEnv* unused_env, | 33 jint GetProfileCount(JNIEnv* unused_env, |
28 const base::android::JavaParamRef<jobject>& unused_obj); | 34 const base::android::JavaParamRef<jobject>& unused_obj); |
29 | 35 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 void RemoveByGUID(JNIEnv* env, | 96 void RemoveByGUID(JNIEnv* env, |
91 const base::android::JavaParamRef<jobject>& unused_obj, | 97 const base::android::JavaParamRef<jobject>& unused_obj, |
92 const base::android::JavaParamRef<jstring>& jguid); | 98 const base::android::JavaParamRef<jstring>& jguid); |
93 | 99 |
94 // Resets the given unmasked card back to the masked state. | 100 // Resets the given unmasked card back to the masked state. |
95 void ClearUnmaskedCache( | 101 void ClearUnmaskedCache( |
96 JNIEnv* env, | 102 JNIEnv* env, |
97 const base::android::JavaParamRef<jobject>& unused_obj, | 103 const base::android::JavaParamRef<jobject>& unused_obj, |
98 const base::android::JavaParamRef<jstring>& jguid); | 104 const base::android::JavaParamRef<jstring>& jguid); |
99 | 105 |
| 106 // Gets the card CVC and unmasks the card (if it's masked). |
| 107 void GetFullCardForPaymentRequest( |
| 108 JNIEnv* env, |
| 109 const base::android::JavaParamRef<jobject>& unused_obj, |
| 110 const base::android::JavaParamRef<jobject>& web_contents_obj, |
| 111 const base::android::JavaParamRef<jstring>& jguid); |
| 112 |
100 // PersonalDataManagerObserver: | 113 // PersonalDataManagerObserver: |
101 void OnPersonalDataChanged() override; | 114 void OnPersonalDataChanged() override; |
102 | 115 |
103 // Registers the JNI bindings for this class. | 116 // Registers the JNI bindings for this class. |
104 static bool Register(JNIEnv* env); | 117 static bool Register(JNIEnv* env); |
105 | 118 |
106 private: | 119 private: |
107 ~PersonalDataManagerAndroid() override; | 120 ~PersonalDataManagerAndroid() override; |
108 | 121 |
| 122 // FullCardRequest::Delegate: |
| 123 void OnFullCardDetails(const CreditCard& card, |
| 124 const base::string16& cvc) override; |
| 125 void OnFullCardError() override; |
| 126 |
109 // Pointer to the java counterpart. | 127 // Pointer to the java counterpart. |
110 JavaObjectWeakGlobalRef weak_java_obj_; | 128 JavaObjectWeakGlobalRef weak_java_obj_; |
111 | 129 |
112 // Pointer to the PersonalDataManager for the main profile. | 130 // Pointer to the PersonalDataManager for the main profile. |
113 PersonalDataManager* personal_data_manager_; | 131 PersonalDataManager* personal_data_manager_; |
114 | 132 |
| 133 base::WeakPtrFactory<PersonalDataManagerAndroid> weak_ptr_factory_; |
| 134 |
115 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid); | 135 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid); |
116 }; | 136 }; |
117 | 137 |
118 } // namespace autofill | 138 } // namespace autofill |
119 | 139 |
120 #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ | 140 #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ |
OLD | NEW |