OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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.payments; | 5 package org.chromium.chrome.browser.payments; |
6 | 6 |
7 import android.os.AsyncTask; | 7 import android.os.AsyncTask; |
8 import android.os.Handler; | 8 import android.os.Handler; |
9 import android.text.TextUtils; | 9 import android.text.TextUtils; |
10 import android.util.Pair; | 10 import android.util.Pair; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 */ | 126 */ |
127 public CardEditor(WebContents webContents, AddressEditor addressEditor, | 127 public CardEditor(WebContents webContents, AddressEditor addressEditor, |
128 @Nullable PaymentRequestServiceObserverForTest observerForTest) { | 128 @Nullable PaymentRequestServiceObserverForTest observerForTest) { |
129 assert webContents != null; | 129 assert webContents != null; |
130 assert addressEditor != null; | 130 assert addressEditor != null; |
131 | 131 |
132 mWebContents = webContents; | 132 mWebContents = webContents; |
133 mAddressEditor = addressEditor; | 133 mAddressEditor = addressEditor; |
134 mObserverForTest = observerForTest; | 134 mObserverForTest = observerForTest; |
135 | 135 |
136 List<AutofillProfile> profiles = PersonalDataManager.getInstance().getPr
ofilesForSettings(); | 136 List<AutofillProfile> profiles = PersonalDataManager.getInstance().getPr
ofilesToSuggest( |
| 137 true /* includeName */); |
137 mProfilesForBillingAddress = new HashMap<>(); | 138 mProfilesForBillingAddress = new HashMap<>(); |
138 for (int i = 0; i < profiles.size(); i++) { | 139 for (int i = 0; i < profiles.size(); i++) { |
139 AutofillProfile profile = profiles.get(i); | 140 AutofillProfile profile = profiles.get(i); |
140 // 1) Include only local profiles, because GUIDs of server profiles
change on every | 141 // 1) Include only local profiles, because GUIDs of server profiles
change on every |
141 // browser restart. Server profiles are not supported as billing
addresses. | 142 // browser restart. Server profiles are not supported as billing
addresses. |
142 // 2) Include only complete profiles, so that user launches the edit
or only when | 143 // 2) Include only complete profiles, so that user launches the edit
or only when |
143 // explicitly selecting [+ ADD ADDRESS] in the dropdown. | 144 // explicitly selecting [+ ADD ADDRESS] in the dropdown. |
144 if (profile.getIsLocal() && mAddressEditor.isProfileComplete(profile
)) { | 145 if (profile.getIsLocal() && mAddressEditor.isProfileComplete(profile
)) { |
145 mProfilesForBillingAddress.put(profile.getGUID(), profile); | 146 mProfilesForBillingAddress.put(profile.getGUID(), profile); |
146 } | 147 } |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 if (!isNewCard) { | 558 if (!isNewCard) { |
558 pdm.setCreditCard(card); | 559 pdm.setCreditCard(card); |
559 return; | 560 return; |
560 } | 561 } |
561 | 562 |
562 if (mSaveCardCheckbox != null && mSaveCardCheckbox.isChecked()) { | 563 if (mSaveCardCheckbox != null && mSaveCardCheckbox.isChecked()) { |
563 card.setGUID(pdm.setCreditCard(card)); | 564 card.setGUID(pdm.setCreditCard(card)); |
564 } | 565 } |
565 } | 566 } |
566 } | 567 } |
OLD | NEW |