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