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 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 const base::android::JavaParamRef<jstring>& jexpiration_month, | 172 const base::android::JavaParamRef<jstring>& jexpiration_month, |
173 const base::android::JavaParamRef<jstring>& jexpiration_year, | 173 const base::android::JavaParamRef<jstring>& jexpiration_year, |
174 const base::android::JavaParamRef<jobject>& jdelegate); | 174 const base::android::JavaParamRef<jobject>& jdelegate); |
175 | 175 |
176 // PersonalDataManagerObserver: | 176 // PersonalDataManagerObserver: |
177 void OnPersonalDataChanged() override; | 177 void OnPersonalDataChanged() override; |
178 | 178 |
179 // Registers the JNI bindings for this class. | 179 // Registers the JNI bindings for this class. |
180 static bool Register(JNIEnv* env); | 180 static bool Register(JNIEnv* env); |
181 | 181 |
| 182 // These functions act on the usage stats of local profiles and credit cards. |
| 183 // -------------------- |
| 184 |
| 185 // Records the use and log usage metrics for the profile associated with the |
| 186 // |jguid|. Increments the use count of the profile and sets its use date to |
| 187 // the current time. |
| 188 void RecordAndLogProfileUse( |
| 189 JNIEnv* env, |
| 190 const base::android::JavaParamRef<jobject>& unused_obj, |
| 191 const base::android::JavaParamRef<jstring>& jguid); |
| 192 |
182 // Sets the use count and use date of the profile associated to the |jguid|. | 193 // 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 | 194 // Both |count| and |date| should be non-negative. |date| represents an |
184 // absolute point in coordinated universal time (UTC) represented as | 195 // absolute point in coordinated universal time (UTC) represented as |
185 // microseconds since the Windows epoch. For more details see the comment | 196 // microseconds since the Windows epoch. For more details see the comment |
186 // header in time.h. | 197 // header in time.h. |
187 void SetProfileUseStatsForTesting( | 198 void SetProfileUseStatsForTesting( |
188 JNIEnv* env, | 199 JNIEnv* env, |
189 const base::android::JavaParamRef<jobject>& unused_obj, | 200 const base::android::JavaParamRef<jobject>& unused_obj, |
190 const base::android::JavaParamRef<jstring>& jguid, | 201 const base::android::JavaParamRef<jstring>& jguid, |
191 jint count, | 202 jint count, |
192 jint date); | 203 jint date); |
193 | 204 |
| 205 // Returns the use count of the profile associated to the |jguid|. |
| 206 jint GetProfileUseCountForTesting( |
| 207 JNIEnv* env, |
| 208 const base::android::JavaParamRef<jobject>& unused_obj, |
| 209 const base::android::JavaParamRef<jstring>& jguid); |
| 210 |
| 211 // Returns the use date of the profile associated to the |jguid|. It |
| 212 // represents an absolute point in coordinated universal time (UTC) |
| 213 // represented as microseconds since the Windows epoch. For more details see |
| 214 // the comment header in time.h. |
| 215 jlong GetProfileUseDateForTesting( |
| 216 JNIEnv* env, |
| 217 const base::android::JavaParamRef<jobject>& unused_obj, |
| 218 const base::android::JavaParamRef<jstring>& jguid); |
| 219 |
| 220 // Records the use and log usage metrics for the credit card associated with |
| 221 // the |jguid|. Increments the use count of the credit card and sets its use |
| 222 // date to the current time. |
| 223 void RecordAndLogCreditCardUse( |
| 224 JNIEnv* env, |
| 225 const base::android::JavaParamRef<jobject>& unused_obj, |
| 226 const base::android::JavaParamRef<jstring>& jguid); |
| 227 |
194 // Sets the use count and use date of the credit card associated to the | 228 // Sets the use count and use date of the credit card associated to the |
195 // |jguid|. Both |count| and |date| should be non-negative. |date| represents | 229 // |jguid|. Both |count| and |date| should be non-negative. |date| represents |
196 // an absolute point in coordinated universal time (UTC) represented as | 230 // an absolute point in coordinated universal time (UTC) represented as |
197 // microseconds since the Windows epoch. For more details see the comment | 231 // microseconds since the Windows epoch. For more details see the comment |
198 // header in time.h. | 232 // header in time.h. |
199 void SetCreditCardUseStatsForTesting( | 233 void SetCreditCardUseStatsForTesting( |
200 JNIEnv* env, | 234 JNIEnv* env, |
201 const base::android::JavaParamRef<jobject>& unused_obj, | 235 const base::android::JavaParamRef<jobject>& unused_obj, |
202 const base::android::JavaParamRef<jstring>& jguid, | 236 const base::android::JavaParamRef<jstring>& jguid, |
203 jint count, | 237 jint count, |
204 jint date); | 238 jint date); |
205 | 239 |
| 240 // Returns the use count of the credit card associated to the |jguid|. |
| 241 jint GetCreditCardUseCountForTesting( |
| 242 JNIEnv* env, |
| 243 const base::android::JavaParamRef<jobject>& unused_obj, |
| 244 const base::android::JavaParamRef<jstring>& jguid); |
| 245 |
| 246 // Returns the use date of the credit card associated to the |jguid|. It |
| 247 // represents an absolute point in coordinated universal time (UTC) |
| 248 // represented as microseconds since the Windows epoch. For more details see |
| 249 // the comment header in time.h. |
| 250 jlong GetCreditCardUseDateForTesting( |
| 251 JNIEnv* env, |
| 252 const base::android::JavaParamRef<jobject>& unused_obj, |
| 253 const base::android::JavaParamRef<jstring>& jguid); |
| 254 |
| 255 // Returns the current date represented as an absolute point in coordinated |
| 256 // universal time (UTC) represented as microseconds since the Unix epoch. For |
| 257 // more details see the comment header in time.h |
| 258 jlong GetCurrentDateForTesting( |
| 259 JNIEnv* env, |
| 260 const base::android::JavaParamRef<jobject>& unused_obj); |
| 261 |
206 private: | 262 private: |
207 ~PersonalDataManagerAndroid() override; | 263 ~PersonalDataManagerAndroid() override; |
208 | 264 |
209 // Returns the GUIDs of the |profiles| passed as parameter. | 265 // Returns the GUIDs of the |profiles| passed as parameter. |
210 base::android::ScopedJavaLocalRef<jobjectArray> GetProfileGUIDs( | 266 base::android::ScopedJavaLocalRef<jobjectArray> GetProfileGUIDs( |
211 JNIEnv* env, | 267 JNIEnv* env, |
212 const std::vector<AutofillProfile*>& profiles); | 268 const std::vector<AutofillProfile*>& profiles); |
213 | 269 |
214 // Returns the GUIDs of the |credit_cards| passed as parameter. | 270 // Returns the GUIDs of the |credit_cards| passed as parameter. |
215 base::android::ScopedJavaLocalRef<jobjectArray> GetCreditCardGUIDs( | 271 base::android::ScopedJavaLocalRef<jobjectArray> GetCreditCardGUIDs( |
(...skipping 17 matching lines...) Expand all Loading... |
233 | 289 |
234 // Pointer to the PersonalDataManager for the main profile. | 290 // Pointer to the PersonalDataManager for the main profile. |
235 PersonalDataManager* personal_data_manager_; | 291 PersonalDataManager* personal_data_manager_; |
236 | 292 |
237 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid); | 293 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid); |
238 }; | 294 }; |
239 | 295 |
240 } // namespace autofill | 296 } // namespace autofill |
241 | 297 |
242 #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ | 298 #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ |
OLD | NEW |