Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: chrome/browser/autofill/android/personal_data_manager_android.h

Issue 2413533003: [Payments] Normalize billing address before sending to the merchant. (Closed)
Patch Set: Addressed comments Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 10 matching lines...) Expand all
21 // therefore a single instance of this wrapper. 21 // therefore a single instance of this wrapper.
22 class PersonalDataManagerAndroid 22 class PersonalDataManagerAndroid
23 : public PersonalDataManagerObserver, 23 : public PersonalDataManagerObserver,
24 public LoadRulesListener, 24 public LoadRulesListener,
25 public base::SupportsWeakPtr<PersonalDataManagerAndroid> { 25 public base::SupportsWeakPtr<PersonalDataManagerAndroid> {
26 public: 26 public:
27 // The interface for the normalization request. 27 // The interface for the normalization request.
28 class Delegate { 28 class Delegate {
29 public: 29 public:
30 virtual void OnRulesSuccessfullyLoaded() = 0; 30 virtual void OnRulesSuccessfullyLoaded() = 0;
31 virtual ~Delegate() {}
31 }; 32 };
32 33
33 PersonalDataManagerAndroid(JNIEnv* env, jobject obj); 34 PersonalDataManagerAndroid(JNIEnv* env, jobject obj);
34 35
35 // Returns true if personal data manager has loaded the initial data. 36 // Returns true if personal data manager has loaded the initial data.
36 jboolean IsDataLoaded( 37 jboolean IsDataLoaded(
37 JNIEnv* env, 38 JNIEnv* env,
38 const base::android::JavaParamRef<jobject>& unused_obj) const; 39 const base::android::JavaParamRef<jobject>& unused_obj) const;
39 40
40 // These functions act on "web profiles" aka "LOCAL_PROFILE" profiles. 41 // These functions act on "web profiles" aka "LOCAL_PROFILE" profiles.
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 292
292 // Normalizes the address of the profile associated with the |guid| with the 293 // Normalizes the address of the profile associated with the |guid| with the
293 // rules associates with the |region_code|. Should only be called when the 294 // rules associates with the |region_code|. Should only be called when the
294 // rules have finished loading. 295 // rules have finished loading.
295 base::android::ScopedJavaLocalRef<jobject> NormalizeAddress( 296 base::android::ScopedJavaLocalRef<jobject> NormalizeAddress(
296 const std::string& guid, 297 const std::string& guid,
297 const std::string& region_code, 298 const std::string& region_code,
298 JNIEnv* env); 299 JNIEnv* env);
299 300
300 // Cancels the pending address normalization task. 301 // Cancels the pending address normalization task.
301 void CancelPendingAddressNormalization( 302 void CancelPendingAddressNormalizations(
302 JNIEnv* env, 303 JNIEnv* env,
303 const base::android::JavaParamRef<jobject>& unused_obj); 304 const base::android::JavaParamRef<jobject>& unused_obj);
304 305
305 private: 306 private:
306 ~PersonalDataManagerAndroid() override; 307 ~PersonalDataManagerAndroid() override;
307 308
308 // Returns the GUIDs of the |profiles| passed as parameter. 309 // Returns the GUIDs of the |profiles| passed as parameter.
309 base::android::ScopedJavaLocalRef<jobjectArray> GetProfileGUIDs( 310 base::android::ScopedJavaLocalRef<jobjectArray> GetProfileGUIDs(
310 JNIEnv* env, 311 JNIEnv* env,
311 const std::vector<AutofillProfile*>& profiles); 312 const std::vector<AutofillProfile*>& profiles);
(...skipping 21 matching lines...) Expand all
333 334
334 // Pointer to the java counterpart. 335 // Pointer to the java counterpart.
335 JavaObjectWeakGlobalRef weak_java_obj_; 336 JavaObjectWeakGlobalRef weak_java_obj_;
336 337
337 // Pointer to the PersonalDataManager for the main profile. 338 // Pointer to the PersonalDataManager for the main profile.
338 PersonalDataManager* personal_data_manager_; 339 PersonalDataManager* personal_data_manager_;
339 340
340 // The address validator used to normalize addresses. 341 // The address validator used to normalize addresses.
341 AddressValidator address_validator_; 342 AddressValidator address_validator_;
342 343
343 // Map associating a region code to a pending normalization. 344 // Map associating a region code to pending normalizations.
344 std::map<std::string, Delegate*> pending_normalization_; 345 std::map<std::string, std::vector<Delegate*>> pending_normalization_;
please use gerrit instead 2016/10/18 17:30:32 Raw pointers are scary because of possible memory
sebsg 2016/10/18 22:44:32 Done.
345 346
346 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid); 347 DISALLOW_COPY_AND_ASSIGN(PersonalDataManagerAndroid);
347 }; 348 };
348 349
349 } // namespace autofill 350 } // namespace autofill
350 351
351 #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_ 352 #endif // CHROME_BROWSER_AUTOFILL_ANDROID_PERSONAL_DATA_MANAGER_ANDROID_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698