Commit 36cd7b46 authored by Jordan Demeulenaere's avatar Jordan Demeulenaere Committed by Commit Bot

[Autofill] Return ArrayList in some PersonalDataManager methods.

Chrome Java style discourages usage of List<> and prefers to use
ArrayList<>. Returning an ArrayList explicitly allows callers to pass
this list in a method that requires an ArrayList as input.

Bug: None
Change-Id: Icbb4d3f5b0c9d38b654dc73bb3c2d3dc935427c1
Reviewed-on: https://chromium-review.googlesource.com/1256795
Commit-Queue: Jordan Demeulenaere <jdemeulenaere@chromium.org>
Reviewed-by: default avatarRouslan Solomakhin <rouslan@chromium.org>
Reviewed-by: default avatarSebastien Seguin-Gagnon <sebsg@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595859}
parent f994c2ce
...@@ -615,7 +615,7 @@ public class PersonalDataManager { ...@@ -615,7 +615,7 @@ public class PersonalDataManager {
* @param includeNameInLabel Whether to include the name in the profile's label. * @param includeNameInLabel Whether to include the name in the profile's label.
* @return The list of profiles to suggest to the user. * @return The list of profiles to suggest to the user.
*/ */
public List<AutofillProfile> getProfilesToSuggest(boolean includeNameInLabel) { public ArrayList<AutofillProfile> getProfilesToSuggest(boolean includeNameInLabel) {
ThreadUtils.assertOnUiThread(); ThreadUtils.assertOnUiThread();
return getProfilesWithLabels( return getProfilesWithLabels(
nativeGetProfileLabelsToSuggest( nativeGetProfileLabelsToSuggest(
...@@ -632,7 +632,7 @@ public class PersonalDataManager { ...@@ -632,7 +632,7 @@ public class PersonalDataManager {
* *
* @return The list of billing addresses to suggest to the user. * @return The list of billing addresses to suggest to the user.
*/ */
public List<AutofillProfile> getBillingAddressesToSuggest() { public ArrayList<AutofillProfile> getBillingAddressesToSuggest() {
ThreadUtils.assertOnUiThread(); ThreadUtils.assertOnUiThread();
return getProfilesWithLabels( return getProfilesWithLabels(
nativeGetProfileLabelsToSuggest( nativeGetProfileLabelsToSuggest(
...@@ -641,9 +641,9 @@ public class PersonalDataManager { ...@@ -641,9 +641,9 @@ public class PersonalDataManager {
nativeGetProfileGUIDsToSuggest(mPersonalDataManagerAndroid)); nativeGetProfileGUIDsToSuggest(mPersonalDataManagerAndroid));
} }
private List<AutofillProfile> getProfilesWithLabels( private ArrayList<AutofillProfile> getProfilesWithLabels(
String[] profileLabels, String[] profileGUIDs) { String[] profileLabels, String[] profileGUIDs) {
List<AutofillProfile> profiles = new ArrayList<AutofillProfile>(profileGUIDs.length); ArrayList<AutofillProfile> profiles = new ArrayList<AutofillProfile>(profileGUIDs.length);
for (int i = 0; i < profileGUIDs.length; i++) { for (int i = 0; i < profileGUIDs.length; i++) {
AutofillProfile profile = AutofillProfile profile =
nativeGetProfileByGUID(mPersonalDataManagerAndroid, profileGUIDs[i]); nativeGetProfileByGUID(mPersonalDataManagerAndroid, profileGUIDs[i]);
...@@ -688,14 +688,14 @@ public class PersonalDataManager { ...@@ -688,14 +688,14 @@ public class PersonalDataManager {
* will have been processed to be more relevant to the user. * will have been processed to be more relevant to the user.
* @param includeServerCards Whether server cards should be included in the response. * @param includeServerCards Whether server cards should be included in the response.
*/ */
public List<CreditCard> getCreditCardsToSuggest(boolean includeServerCards) { public ArrayList<CreditCard> getCreditCardsToSuggest(boolean includeServerCards) {
ThreadUtils.assertOnUiThread(); ThreadUtils.assertOnUiThread();
return getCreditCards( return getCreditCards(
nativeGetCreditCardGUIDsToSuggest(mPersonalDataManagerAndroid, includeServerCards)); nativeGetCreditCardGUIDsToSuggest(mPersonalDataManagerAndroid, includeServerCards));
} }
private List<CreditCard> getCreditCards(String[] creditCardGUIDs) { private ArrayList<CreditCard> getCreditCards(String[] creditCardGUIDs) {
List<CreditCard> cards = new ArrayList<CreditCard>(creditCardGUIDs.length); ArrayList<CreditCard> cards = new ArrayList<CreditCard>(creditCardGUIDs.length);
for (int i = 0; i < creditCardGUIDs.length; i++) { for (int i = 0; i < creditCardGUIDs.length; i++) {
cards.add(nativeGetCreditCardByGUID(mPersonalDataManagerAndroid, creditCardGUIDs[i])); cards.add(nativeGetCreditCardByGUID(mPersonalDataManagerAndroid, creditCardGUIDs[i]));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment