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 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 Loading... | |
| 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(nativeGetProfileLabelsToSuggest(mPersonalDa taManagerAndroid, |
| 541 includeName), | |
|
please use gerrit instead
2016/08/26 16:46:15
This indentation looks funny. Something like this
sebsg
2016/08/26 19:36:45
Done.
| |
| 536 nativeGetProfileGUIDsToSuggest(mPersonalDataManagerAndroid)); | 542 nativeGetProfileGUIDsToSuggest(mPersonalDataManagerAndroid)); |
| 537 } | 543 } |
| 538 | 544 |
| 539 private List<AutofillProfile> getProfilesWithLabels( | 545 private List<AutofillProfile> getProfilesWithLabels( |
| 540 String[] profileLabels, String[] profileGUIDs) { | 546 String[] profileLabels, String[] profileGUIDs) { |
| 541 List<AutofillProfile> profiles = new ArrayList<AutofillProfile>(profileG UIDs.length); | 547 List<AutofillProfile> profiles = new ArrayList<AutofillProfile>(profileG UIDs.length); |
| 542 for (int i = 0; i < profileGUIDs.length; i++) { | 548 for (int i = 0; i < profileGUIDs.length; i++) { |
| 543 AutofillProfile profile = | 549 AutofillProfile profile = |
| 544 nativeGetProfileByGUID(mPersonalDataManagerAndroid, profileG UIDs[i]); | 550 nativeGetProfileByGUID(mPersonalDataManagerAndroid, profileG UIDs[i]); |
| 545 profile.setLabel(profileLabels[i]); | 551 profile.setLabel(profileLabels[i]); |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 744 */ | 750 */ |
| 745 public static void setPaymentsIntegrationEnabled(boolean enable) { | 751 public static void setPaymentsIntegrationEnabled(boolean enable) { |
| 746 nativeSetPaymentsIntegrationEnabled(enable); | 752 nativeSetPaymentsIntegrationEnabled(enable); |
| 747 } | 753 } |
| 748 | 754 |
| 749 private native long nativeInit(); | 755 private native long nativeInit(); |
| 750 private native String[] nativeGetProfileGUIDsForSettings(long nativePersonal DataManagerAndroid); | 756 private native String[] nativeGetProfileGUIDsForSettings(long nativePersonal DataManagerAndroid); |
| 751 private native String[] nativeGetProfileGUIDsToSuggest(long nativePersonalDa taManagerAndroid); | 757 private native String[] nativeGetProfileGUIDsToSuggest(long nativePersonalDa taManagerAndroid); |
| 752 private native String[] nativeGetProfileLabelsForSettings( | 758 private native String[] nativeGetProfileLabelsForSettings( |
| 753 long nativePersonalDataManagerAndroid); | 759 long nativePersonalDataManagerAndroid); |
| 754 private native String[] nativeGetProfileLabelsToSuggest(long nativePersonalD ataManagerAndroid); | 760 private native String[] nativeGetProfileLabelsToSuggest(long nativePersonalD ataManagerAndroid, |
| 761 boolean includeName); | |
| 755 private native AutofillProfile nativeGetProfileByGUID(long nativePersonalDat aManagerAndroid, | 762 private native AutofillProfile nativeGetProfileByGUID(long nativePersonalDat aManagerAndroid, |
| 756 String guid); | 763 String guid); |
| 757 private native String nativeSetProfile(long nativePersonalDataManagerAndroid , | 764 private native String nativeSetProfile(long nativePersonalDataManagerAndroid , |
| 758 AutofillProfile profile); | 765 AutofillProfile profile); |
| 759 private native String nativeGetAddressLabelForPaymentRequest( | 766 private native String nativeGetAddressLabelForPaymentRequest( |
| 760 long nativePersonalDataManagerAndroid, AutofillProfile profile); | 767 long nativePersonalDataManagerAndroid, AutofillProfile profile); |
| 761 private native String[] nativeGetCreditCardGUIDsForSettings( | 768 private native String[] nativeGetCreditCardGUIDsForSettings( |
| 762 long nativePersonalDataManagerAndroid); | 769 long nativePersonalDataManagerAndroid); |
| 763 private native String[] nativeGetCreditCardGUIDsToSuggest( | 770 private native String[] nativeGetCreditCardGUIDsToSuggest( |
| 764 long nativePersonalDataManagerAndroid); | 771 long nativePersonalDataManagerAndroid); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 796 long nativePersonalDataManagerAndroid, String guid); | 803 long nativePersonalDataManagerAndroid, String guid); |
| 797 private native void nativeGetFullCardForPaymentRequest(long nativePersonalDa taManagerAndroid, | 804 private native void nativeGetFullCardForPaymentRequest(long nativePersonalDa taManagerAndroid, |
| 798 WebContents webContents, CreditCard card, FullCardRequestDelegate de legate); | 805 WebContents webContents, CreditCard card, FullCardRequestDelegate de legate); |
| 799 private static native boolean nativeIsAutofillEnabled(); | 806 private static native boolean nativeIsAutofillEnabled(); |
| 800 private static native void nativeSetAutofillEnabled(boolean enable); | 807 private static native void nativeSetAutofillEnabled(boolean enable); |
| 801 private static native boolean nativeIsAutofillManaged(); | 808 private static native boolean nativeIsAutofillManaged(); |
| 802 private static native boolean nativeIsPaymentsIntegrationEnabled(); | 809 private static native boolean nativeIsPaymentsIntegrationEnabled(); |
| 803 private static native void nativeSetPaymentsIntegrationEnabled(boolean enabl e); | 810 private static native void nativeSetPaymentsIntegrationEnabled(boolean enabl e); |
| 804 private static native String nativeToCountryCode(String countryName); | 811 private static native String nativeToCountryCode(String countryName); |
| 805 } | 812 } |
| OLD | NEW |