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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 const base::android::JavaParamRef<jobject>& jweb_contents, | 134 const base::android::JavaParamRef<jobject>& jweb_contents, |
135 const base::android::JavaParamRef<jstring>& jguid, | 135 const base::android::JavaParamRef<jstring>& jguid, |
136 const base::android::JavaParamRef<jobject>& jdelegate); | 136 const base::android::JavaParamRef<jobject>& jdelegate); |
137 | 137 |
138 // PersonalDataManagerObserver: | 138 // PersonalDataManagerObserver: |
139 void OnPersonalDataChanged() override; | 139 void OnPersonalDataChanged() override; |
140 | 140 |
141 // Registers the JNI bindings for this class. | 141 // Registers the JNI bindings for this class. |
142 static bool Register(JNIEnv* env); | 142 static bool Register(JNIEnv* env); |
143 | 143 |
| 144 // These functions act on the usage stats of local profiles and credit cards. |
| 145 // -------------------- |
| 146 |
| 147 // Records the use and log usage metrics for the profile associated with the |
| 148 // |jguid|. Increments the use count of the profile and sets its use date to |
| 149 // the current time. |
| 150 void RecordAndLogProfileUse( |
| 151 JNIEnv* env, |
| 152 const base::android::JavaParamRef<jobject>& unused_obj, |
| 153 const base::android::JavaParamRef<jstring>& jguid); |
| 154 |
144 // Sets the use count and use date of the profile associated to the |jguid|. | 155 // 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 | 156 // Both |count| and |date| should be non-negative. |date| represents an |
146 // absolute point in coordinated universal time (UTC) represented as | 157 // absolute point in coordinated universal time (UTC) represented as |
147 // microseconds since the Windows epoch. For more details see the comment | 158 // microseconds since the Windows epoch. For more details see the comment |
148 // header in time.h. | 159 // header in time.h. |
149 void SetProfileUseStatsForTesting( | 160 void SetProfileUseStatsForTesting( |
150 JNIEnv* env, | 161 JNIEnv* env, |
151 const base::android::JavaParamRef<jobject>& unused_obj, | 162 const base::android::JavaParamRef<jobject>& unused_obj, |
152 const base::android::JavaParamRef<jstring>& jguid, | 163 const base::android::JavaParamRef<jstring>& jguid, |
153 jint count, | 164 jint count, |
154 jint date); | 165 jint date); |
155 | 166 |
| 167 // Returns the use count of the profile associated to the |jguid|. |
| 168 jint GetProfileUseCountForTesting( |
| 169 JNIEnv* env, |
| 170 const base::android::JavaParamRef<jobject>& unused_obj, |
| 171 const base::android::JavaParamRef<jstring>& jguid); |
| 172 |
| 173 // Returns the use date of the profile associated to the |jguid|. It |
| 174 // represents an absolute point in coordinated universal time (UTC) |
| 175 // represented as microseconds since the Windows epoch. For more details see |
| 176 // the comment header in time.h. |
| 177 jlong GetProfileUseDateForTesting( |
| 178 JNIEnv* env, |
| 179 const base::android::JavaParamRef<jobject>& unused_obj, |
| 180 const base::android::JavaParamRef<jstring>& jguid); |
| 181 |
| 182 // Records the use and log usage metrics for the credit card associated with |
| 183 // the |jguid|. Increments the use count of the credit card and sets its use |
| 184 // date to the current time. |
| 185 void RecordAndLogCreditCardUse( |
| 186 JNIEnv* env, |
| 187 const base::android::JavaParamRef<jobject>& unused_obj, |
| 188 const base::android::JavaParamRef<jstring>& jguid); |
| 189 |
156 // Sets the use count and use date of the credit card associated to the | 190 // Sets the use count and use date of the credit card associated to the |
157 // |jguid|. Both |count| and |date| should be non-negative. |date| represents | 191 // |jguid|. Both |count| and |date| should be non-negative. |date| represents |
158 // an absolute point in coordinated universal time (UTC) represented as | 192 // an absolute point in coordinated universal time (UTC) represented as |
159 // microseconds since the Windows epoch. For more details see the comment | 193 // microseconds since the Windows epoch. For more details see the comment |
160 // header in time.h. | 194 // header in time.h. |
161 void SetCreditCardUseStatsForTesting( | 195 void SetCreditCardUseStatsForTesting( |
162 JNIEnv* env, | 196 JNIEnv* env, |
163 const base::android::JavaParamRef<jobject>& unused_obj, | 197 const base::android::JavaParamRef<jobject>& unused_obj, |
164 const base::android::JavaParamRef<jstring>& jguid, | 198 const base::android::JavaParamRef<jstring>& jguid, |
165 jint count, | 199 jint count, |
166 jint date); | 200 jint date); |
167 | 201 |
| 202 // Returns the use count of the credit card associated to the |jguid|. |
| 203 jint GetCreditCardUseCountForTesting( |
| 204 JNIEnv* env, |
| 205 const base::android::JavaParamRef<jobject>& unused_obj, |
| 206 const base::android::JavaParamRef<jstring>& jguid); |
| 207 |
| 208 // Returns the use date of the credit card associated to the |jguid|. It |
| 209 // represents an absolute point in coordinated universal time (UTC) |
| 210 // represented as microseconds since the Windows epoch. For more details see |
| 211 // the comment header in time.h. |
| 212 jlong GetCreditCardUseDateForTesting( |
| 213 JNIEnv* env, |
| 214 const base::android::JavaParamRef<jobject>& unused_obj, |
| 215 const base::android::JavaParamRef<jstring>& jguid); |
| 216 |
| 217 // Returns the current date represented as an absolute point in coordinated |
| 218 // universal time (UTC) represented as microseconds since the Windows epoch. |
| 219 // For more details see the comment header in time.h |
| 220 jlong GetCurrentDateForTesting( |
| 221 JNIEnv* env, |
| 222 const base::android::JavaParamRef<jobject>& unused_obj); |
| 223 |
168 private: | 224 private: |
169 ~PersonalDataManagerAndroid() override; | 225 ~PersonalDataManagerAndroid() override; |
170 | 226 |
171 // Returns the GUIDs of the |profiles| passed as parameter. | 227 // Returns the GUIDs of the |profiles| passed as parameter. |
172 base::android::ScopedJavaLocalRef<jobjectArray> GetProfileGUIDs( | 228 base::android::ScopedJavaLocalRef<jobjectArray> GetProfileGUIDs( |
173 JNIEnv* env, | 229 JNIEnv* env, |
174 const std::vector<AutofillProfile*>& profiles); | 230 const std::vector<AutofillProfile*>& profiles); |
175 | 231 |
176 // Returns the GUIDs of the |credit_cards| passed as parameter. | 232 // Returns the GUIDs of the |credit_cards| passed as parameter. |
177 base::android::ScopedJavaLocalRef<jobjectArray> GetCreditCardGUIDs( | 233 base::android::ScopedJavaLocalRef<jobjectArray> GetCreditCardGUIDs( |
(...skipping 17 matching lines...) Expand all Loading... |
195 | 251 |
196 // Pointer to the PersonalDataManager for the main profile. | 252 // Pointer to the PersonalDataManager for the main profile. |
197 PersonalDataManager* personal_data_manager_; | 253 PersonalDataManager* personal_data_manager_; |
198 | 254 |
199 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid); | 255 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid); |
200 }; | 256 }; |
201 | 257 |
202 } // namespace autofill | 258 } // namespace autofill |
203 | 259 |
204 #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ | 260 #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ |
OLD | NEW |