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

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/autofill/PersonalDataManager.java

Issue 2287513002: [Payments] Show name and address when selecting a CC billing address. (Closed)
Patch Set: Fixed error Created 4 years, 3 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 package org.chromium.chrome.browser.autofill; 5 package org.chromium.chrome.browser.autofill;
6 6
7 import android.content.Context; 7 import android.content.Context;
8 8
9 import org.chromium.base.ThreadUtils; 9 import org.chromium.base.ThreadUtils;
10 import org.chromium.base.VisibleForTesting; 10 import org.chromium.base.VisibleForTesting;
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 ThreadUtils.assertOnUiThread(); 511 ThreadUtils.assertOnUiThread();
512 assert (mDataObservers.size() > 0); 512 assert (mDataObservers.size() > 0);
513 assert (mDataObservers.contains(observer)); 513 assert (mDataObservers.contains(observer));
514 mDataObservers.remove(observer); 514 mDataObservers.remove(observer);
515 } 515 }
516 516
517 // TODO(crbug.com/616102): Reduce the number of Java to Native calls when ge tting profiles. 517 // TODO(crbug.com/616102): Reduce the number of Java to Native calls when ge tting profiles.
518 /** 518 /**
519 * Gets the profiles to show in the settings page. Returns all the profiles without any 519 * Gets the profiles to show in the settings page. Returns all the profiles without any
520 * processing. 520 * processing.
521 *
522 * @return The list of profiles to show in the settings.
521 */ 523 */
522 public List<AutofillProfile> getProfilesForSettings() { 524 public List<AutofillProfile> getProfilesForSettings() {
523 ThreadUtils.assertOnUiThread(); 525 ThreadUtils.assertOnUiThread();
524 return getProfilesWithLabels(nativeGetProfileLabelsForSettings(mPersonal DataManagerAndroid), 526 return getProfilesWithLabels(nativeGetProfileLabelsForSettings(mPersonal DataManagerAndroid),
525 nativeGetProfileGUIDsForSettings(mPersonalDataManagerAndroid)); 527 nativeGetProfileGUIDsForSettings(mPersonalDataManagerAndroid));
526 } 528 }
527 529
528 // TODO(crbug.com/616102): Reduce the number of Java to Native calls when ge tting profiles. 530 // TODO(crbug.com/616102): Reduce the number of Java to Native calls when ge tting profiles.
529 /** 531 /**
530 * Gets the profiles to suggest when filling a form or completing a transact ion. The profiles 532 * Gets the profiles to suggest when filling a form or completing a transact ion. The profiles
531 * will have been processed to be more relevant to the user. 533 * will have been processed to be more relevant to the user.
534 *
535 * @param includeName Whether to include the name in the profile's label.
536 * @return The list of profiles to suggest to the user.
532 */ 537 */
533 public List<AutofillProfile> getProfilesToSuggest() { 538 public List<AutofillProfile> getProfilesToSuggest(boolean includeName) {
534 ThreadUtils.assertOnUiThread(); 539 ThreadUtils.assertOnUiThread();
535 return getProfilesWithLabels(nativeGetProfileLabelsToSuggest(mPersonalDa taManagerAndroid), 540 return getProfilesWithLabels(
541 nativeGetProfileLabelsToSuggest(
542 mPersonalDataManagerAndroid, includeName),
536 nativeGetProfileGUIDsToSuggest(mPersonalDataManagerAndroid)); 543 nativeGetProfileGUIDsToSuggest(mPersonalDataManagerAndroid));
537 } 544 }
538 545
539 private List<AutofillProfile> getProfilesWithLabels( 546 private List<AutofillProfile> getProfilesWithLabels(
540 String[] profileLabels, String[] profileGUIDs) { 547 String[] profileLabels, String[] profileGUIDs) {
541 List<AutofillProfile> profiles = new ArrayList<AutofillProfile>(profileG UIDs.length); 548 List<AutofillProfile> profiles = new ArrayList<AutofillProfile>(profileG UIDs.length);
542 for (int i = 0; i < profileGUIDs.length; i++) { 549 for (int i = 0; i < profileGUIDs.length; i++) {
543 AutofillProfile profile = 550 AutofillProfile profile =
544 nativeGetProfileByGUID(mPersonalDataManagerAndroid, profileG UIDs[i]); 551 nativeGetProfileByGUID(mPersonalDataManagerAndroid, profileG UIDs[i]);
545 profile.setLabel(profileLabels[i]); 552 profile.setLabel(profileLabels[i]);
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 */ 751 */
745 public static void setPaymentsIntegrationEnabled(boolean enable) { 752 public static void setPaymentsIntegrationEnabled(boolean enable) {
746 nativeSetPaymentsIntegrationEnabled(enable); 753 nativeSetPaymentsIntegrationEnabled(enable);
747 } 754 }
748 755
749 private native long nativeInit(); 756 private native long nativeInit();
750 private native String[] nativeGetProfileGUIDsForSettings(long nativePersonal DataManagerAndroid); 757 private native String[] nativeGetProfileGUIDsForSettings(long nativePersonal DataManagerAndroid);
751 private native String[] nativeGetProfileGUIDsToSuggest(long nativePersonalDa taManagerAndroid); 758 private native String[] nativeGetProfileGUIDsToSuggest(long nativePersonalDa taManagerAndroid);
752 private native String[] nativeGetProfileLabelsForSettings( 759 private native String[] nativeGetProfileLabelsForSettings(
753 long nativePersonalDataManagerAndroid); 760 long nativePersonalDataManagerAndroid);
754 private native String[] nativeGetProfileLabelsToSuggest(long nativePersonalD ataManagerAndroid); 761 private native String[] nativeGetProfileLabelsToSuggest(long nativePersonalD ataManagerAndroid,
762 boolean includeName);
755 private native AutofillProfile nativeGetProfileByGUID(long nativePersonalDat aManagerAndroid, 763 private native AutofillProfile nativeGetProfileByGUID(long nativePersonalDat aManagerAndroid,
756 String guid); 764 String guid);
757 private native String nativeSetProfile(long nativePersonalDataManagerAndroid , 765 private native String nativeSetProfile(long nativePersonalDataManagerAndroid ,
758 AutofillProfile profile); 766 AutofillProfile profile);
759 private native String nativeGetAddressLabelForPaymentRequest( 767 private native String nativeGetAddressLabelForPaymentRequest(
760 long nativePersonalDataManagerAndroid, AutofillProfile profile); 768 long nativePersonalDataManagerAndroid, AutofillProfile profile);
761 private native String[] nativeGetCreditCardGUIDsForSettings( 769 private native String[] nativeGetCreditCardGUIDsForSettings(
762 long nativePersonalDataManagerAndroid); 770 long nativePersonalDataManagerAndroid);
763 private native String[] nativeGetCreditCardGUIDsToSuggest( 771 private native String[] nativeGetCreditCardGUIDsToSuggest(
764 long nativePersonalDataManagerAndroid); 772 long nativePersonalDataManagerAndroid);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
796 long nativePersonalDataManagerAndroid, String guid); 804 long nativePersonalDataManagerAndroid, String guid);
797 private native void nativeGetFullCardForPaymentRequest(long nativePersonalDa taManagerAndroid, 805 private native void nativeGetFullCardForPaymentRequest(long nativePersonalDa taManagerAndroid,
798 WebContents webContents, CreditCard card, FullCardRequestDelegate de legate); 806 WebContents webContents, CreditCard card, FullCardRequestDelegate de legate);
799 private static native boolean nativeIsAutofillEnabled(); 807 private static native boolean nativeIsAutofillEnabled();
800 private static native void nativeSetAutofillEnabled(boolean enable); 808 private static native void nativeSetAutofillEnabled(boolean enable);
801 private static native boolean nativeIsAutofillManaged(); 809 private static native boolean nativeIsAutofillManaged();
802 private static native boolean nativeIsPaymentsIntegrationEnabled(); 810 private static native boolean nativeIsPaymentsIntegrationEnabled();
803 private static native void nativeSetPaymentsIntegrationEnabled(boolean enabl e); 811 private static native void nativeSetPaymentsIntegrationEnabled(boolean enabl e);
804 private static native String nativeToCountryCode(String countryName); 812 private static native String nativeToCountryCode(String countryName);
805 } 813 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698