Chromium Code Reviews| 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 <map> | |
| 9 #include <memory> | |
| 10 #include <string> | |
| 11 #include <vector> | |
| 12 | |
| 8 #include "base/android/jni_weak_ref.h" | 13 #include "base/android/jni_weak_ref.h" |
| 9 #include "base/android/scoped_java_ref.h" | 14 #include "base/android/scoped_java_ref.h" |
| 10 #include "base/macros.h" | 15 #include "base/macros.h" |
| 11 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
| 12 #include "chrome/browser/autofill/validation_rules_storage_factory.h" | 17 #include "chrome/browser/autofill/validation_rules_storage_factory.h" |
| 13 #include "components/autofill/core/browser/personal_data_manager.h" | 18 #include "components/autofill/core/browser/personal_data_manager.h" |
| 14 #include "components/autofill/core/browser/personal_data_manager_observer.h" | 19 #include "components/autofill/core/browser/personal_data_manager_observer.h" |
| 15 #include "third_party/libaddressinput/chromium/chrome_address_validator.h" | 20 #include "third_party/libaddressinput/chromium/chrome_address_validator.h" |
| 16 | 21 |
| 17 namespace autofill { | 22 namespace autofill { |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 base::android::ScopedJavaLocalRef<jobject> NormalizeAddress( | 330 base::android::ScopedJavaLocalRef<jobject> NormalizeAddress( |
| 326 const std::string& guid, | 331 const std::string& guid, |
| 327 const std::string& region_code, | 332 const std::string& region_code, |
| 328 JNIEnv* env); | 333 JNIEnv* env); |
| 329 | 334 |
| 330 // Cancels the pending address normalization task. | 335 // Cancels the pending address normalization task. |
| 331 void CancelPendingAddressNormalizations( | 336 void CancelPendingAddressNormalizations( |
| 332 JNIEnv* env, | 337 JNIEnv* env, |
| 333 const base::android::JavaParamRef<jobject>& unused_obj); | 338 const base::android::JavaParamRef<jobject>& unused_obj); |
| 334 | 339 |
| 340 // Gets the sub-keys for the region with |jregion_code| code, if the | |
| 341 // |jregion_code| rules have finished loading. Otherwise, sets up a task to | |
| 342 // get the sub-keys, when the rules are loaded. | |
| 343 void StartGettingRegionSubKeys( | |
| 344 JNIEnv* env, | |
| 345 const base::android::JavaParamRef<jobject>& unused_obj, | |
| 346 const base::android::JavaParamRef<jstring>& jregion_code, | |
| 347 const base::android::JavaParamRef<jobject>& jdelegate); | |
| 348 | |
| 349 // Gets the sub-keys of the rule associated with |jregion_code|. Should only | |
| 350 // be called when the rules are loaded. | |
| 351 base::android::ScopedJavaLocalRef<jobjectArray> GetSubKeys( | |
| 352 JNIEnv* env, | |
| 353 const std::string& jregion_code); | |
| 354 | |
| 355 // Callback of the sub-keys request. | |
| 356 // This is called when the sub-keys are loaded. | |
| 357 void OnGettingSubKeysRulesLoaded(const std::string& region_code, | |
|
sebsg
2017/02/10 16:00:32
As mentioned, this is probably not necessary.
| |
| 358 bool success) override; | |
| 359 | |
| 360 // Cancels the pending sub-key request task. | |
| 361 void CancelPendingGetSubKeys( | |
| 362 JNIEnv* env, | |
| 363 const base::android::JavaParamRef<jobject>& unused_obj); | |
| 364 | |
| 335 private: | 365 private: |
| 336 ~PersonalDataManagerAndroid() override; | 366 ~PersonalDataManagerAndroid() override; |
| 337 | 367 |
| 338 // Returns the GUIDs of the |profiles| passed as parameter. | 368 // Returns the GUIDs of the |profiles| passed as parameter. |
| 339 base::android::ScopedJavaLocalRef<jobjectArray> GetProfileGUIDs( | 369 base::android::ScopedJavaLocalRef<jobjectArray> GetProfileGUIDs( |
| 340 JNIEnv* env, | 370 JNIEnv* env, |
| 341 const std::vector<AutofillProfile*>& profiles); | 371 const std::vector<AutofillProfile*>& profiles); |
| 342 | 372 |
| 343 // Returns the GUIDs of the |credit_cards| passed as parameter. | 373 // Returns the GUIDs of the |credit_cards| passed as parameter. |
| 344 base::android::ScopedJavaLocalRef<jobjectArray> GetCreditCardGUIDs( | 374 base::android::ScopedJavaLocalRef<jobjectArray> GetCreditCardGUIDs( |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 379 // Pointer to the PersonalDataManager for the main profile. | 409 // Pointer to the PersonalDataManager for the main profile. |
| 380 PersonalDataManager* personal_data_manager_; | 410 PersonalDataManager* personal_data_manager_; |
| 381 | 411 |
| 382 // The address validator used to normalize addresses. | 412 // The address validator used to normalize addresses. |
| 383 AddressValidator address_validator_; | 413 AddressValidator address_validator_; |
| 384 | 414 |
| 385 // Map associating a region code to pending normalizations. | 415 // Map associating a region code to pending normalizations. |
| 386 std::map<std::string, std::vector<std::unique_ptr<Delegate>>> | 416 std::map<std::string, std::vector<std::unique_ptr<Delegate>>> |
| 387 pending_normalization_; | 417 pending_normalization_; |
| 388 | 418 |
| 419 // Map associating a region code to pending sub-keys' request. | |
| 420 std::map<std::string, std::vector<std::unique_ptr<Delegate>>> | |
| 421 pending_subkeys_request_; | |
| 422 | |
| 389 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid); | 423 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid); |
| 390 }; | 424 }; |
| 391 | 425 |
| 392 } // namespace autofill | 426 } // namespace autofill |
| 393 | 427 |
| 394 #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ | 428 #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ |
| OLD | NEW |