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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/payments/CardEditor.java

Issue 2581293002: [PR] Fix selection when cancelling out of add billing address flow (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBillingAddressTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/payments/CardEditor.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/CardEditor.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/CardEditor.java
index b33dcacf3bad398b61313cef0f440a05475c321c..d47999e8a9c50395bcae7233fe761b7cd50b32df 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/payments/CardEditor.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/CardEditor.java
@@ -555,8 +555,14 @@ public class CardEditor extends EditorBase<AutofillPaymentInstrument>
@Override
public void onResult(AutofillAddress billingAddress) {
if (billingAddress == null) {
- // User has cancelled the address editor.
- mBillingAddressField.setValue(null);
+ // User cancelled out of the "add flow". Restore the selection to the
+ // card's billing address, if any, else clear the selection.
+ if (mBillingAddressField.getDropdownKeys().contains(
+ card.getBillingAddressId())) {
+ mBillingAddressField.setValue(card.getBillingAddressId());
+ } else {
+ mBillingAddressField.setValue(null);
+ }
} else {
// Set the billing address label.
billingAddress.setBillingAddressLabel();
« no previous file with comments | « no previous file | chrome/android/javatests/src/org/chromium/chrome/browser/payments/PaymentRequestBillingAddressTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698