Chromium Code Reviews| Index: chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java |
| diff --git a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java |
| index 5069a737c5cfe6cd6329fad4052970fb026eb6e7..6d1e29770fed97d9c77ce9a1be3c5dda28eb9a20 100644 |
| --- a/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java |
| +++ b/chrome/android/java/src/org/chromium/chrome/browser/payments/PaymentRequestImpl.java |
| @@ -687,9 +687,9 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie |
| } |
| @Override |
| - @PaymentRequestUI.SelectionResult public int onSectionOptionSelected( |
| - @PaymentRequestUI.DataType int optionType, PaymentOption option, |
| - Callback<PaymentInformation> callback) { |
| + @PaymentRequestUI.SelectionResult |
| + public int onSectionOptionSelected(@PaymentRequestUI.DataType int optionType, |
| + PaymentOption option, Callback<PaymentInformation> callback) { |
| if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES) { |
| assert option instanceof AutofillAddress; |
| // Log the change of shipping address. |
| @@ -745,7 +745,35 @@ public class PaymentRequestImpl implements PaymentRequest, PaymentRequestUI.Clie |
| } |
| @Override |
| - @PaymentRequestUI.SelectionResult public int onSectionAddOption( |
| + @PaymentRequestUI.SelectionResult |
| + public int onSectionEditOption(@PaymentRequestUI.DataType int optionType, PaymentOption option, |
| + Callback<PaymentInformation> callback) { |
| + if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES |
| + && option instanceof AutofillAddress) { |
|
please use gerrit instead
2016/11/14 21:51:42
You can "assert ption instanceof AutofillAddress"
gogerald1
2016/11/15 16:43:39
Done. Yes, was thinking it might be slightly worth
please use gerrit instead
2016/11/15 16:47:37
The best way to avoid unexpected is to add tests ;
|
| + editAddress((AutofillAddress) option); |
| + mPaymentInformationCallback = callback; |
|
please use gerrit instead
2016/11/14 21:51:41
Please log the journey metrics for PaymentRequestJ
gogerald1
2016/11/15 16:43:39
Do you mean PaymentRequestJourneyLogger.incrementS
|
| + return PaymentRequestUI.SELECTION_RESULT_ASYNCHRONOUS_VALIDATION; |
| + } |
| + |
| + if (optionType == PaymentRequestUI.TYPE_CONTACT_DETAILS |
| + && option instanceof AutofillContact) { |
|
please use gerrit instead
2016/11/14 21:51:42
Assert instead of check.
gogerald1
2016/11/15 16:43:39
Done.
|
| + editContact((AutofillContact) option); |
|
please use gerrit instead
2016/11/14 21:51:41
Log the journey metrics.
gogerald1
2016/11/15 16:43:39
ditto
|
| + return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; |
| + } |
| + |
| + if (optionType == PaymentRequestUI.TYPE_PAYMENT_METHODS |
| + && option instanceof AutofillPaymentInstrument) { |
|
please use gerrit instead
2016/11/14 21:51:42
Assert instead of check. Non-autofill payment inst
gogerald1
2016/11/15 16:43:39
Done.
|
| + editCard((AutofillPaymentInstrument) option); |
|
please use gerrit instead
2016/11/14 21:51:42
Log the journey metrics.
gogerald1
2016/11/15 16:43:39
ditto
|
| + return PaymentRequestUI.SELECTION_RESULT_EDITOR_LAUNCH; |
| + } |
| + |
| + assert false; // should never reach here. |
|
please use gerrit instead
2016/11/14 21:51:41
Nit: remove the comment. It's clear what's going o
gogerald1
2016/11/15 16:43:39
Done.
|
| + return PaymentRequestUI.SELECTION_RESULT_NONE; |
| + } |
| + |
| + @Override |
| + @PaymentRequestUI.SelectionResult |
| + public int onSectionAddOption( |
| @PaymentRequestUI.DataType int optionType, Callback<PaymentInformation> callback) { |
| if (optionType == PaymentRequestUI.TYPE_SHIPPING_ADDRESSES) { |
| editAddress(null); |