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 org.chromium.chrome.browser.autofill.PersonalDataManager; | 7 import org.chromium.chrome.browser.autofill.PersonalDataManager; |
8 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; | 8 import org.chromium.chrome.browser.autofill.PersonalDataManager.AutofillProfile; |
9 import org.chromium.chrome.browser.autofill.PersonalDataManager.NormalizedAddres sRequestDelegate; | 9 import org.chromium.chrome.browser.autofill.PersonalDataManager.NormalizedAddres sRequestDelegate; |
10 import org.chromium.chrome.browser.payments.ui.PaymentOption; | 10 import org.chromium.chrome.browser.payments.ui.PaymentOption; |
(...skipping 22 matching lines...) Expand all Loading... | |
33 private boolean mIsWaitingForPaymentsDetails = true; | 33 private boolean mIsWaitingForPaymentsDetails = true; |
34 | 34 |
35 /** | 35 /** |
36 * Builds a helper to contruct and fill a PaymentResponse. | 36 * Builds a helper to contruct and fill a PaymentResponse. |
37 * | 37 * |
38 * @param selectedShippingAddress The shipping address picked by the user. | 38 * @param selectedShippingAddress The shipping address picked by the user. |
39 * @param selectedShippingOption The shipping option picked by the user. | 39 * @param selectedShippingOption The shipping option picked by the user. |
40 * @param selectedContact The contact info picked by the user. | 40 * @param selectedContact The contact info picked by the user. |
41 * @param delegate The object that will recieve the completed PaymentResponse. | 41 * @param delegate The object that will recieve the completed PaymentResponse. |
42 */ | 42 */ |
43 public PaymentResponseHelper(PaymentOption selectedShippingAddress, | 43 public PaymentResponseHelper(String requestId, PaymentOption selectedShippin gAddress, |
please use gerrit instead
2017/03/27 16:22:36
No need.
rwlbuis
2017/03/27 20:45:29
Done.
| |
44 PaymentOption selectedShippingOption, PaymentOption selectedContact, | 44 PaymentOption selectedShippingOption, PaymentOption selectedContact, |
45 PaymentResponseRequesterDelegate delegate) { | 45 PaymentResponseRequesterDelegate delegate) { |
46 mPaymentResponse = new PaymentResponse(); | 46 mPaymentResponse = new PaymentResponse(); |
47 | 47 |
48 mPaymentResponse.requestId = requestId; | |
please use gerrit instead
2017/03/27 16:22:36
No need.
rwlbuis
2017/03/27 20:45:29
Done.
| |
49 | |
48 mDelegate = delegate; | 50 mDelegate = delegate; |
49 | 51 |
50 // Set up the contact section of the response. | 52 // Set up the contact section of the response. |
51 if (selectedContact != null) { | 53 if (selectedContact != null) { |
52 // Contacts are created in PaymentRequestImpl.init(). These should a ll be instances of | 54 // Contacts are created in PaymentRequestImpl.init(). These should a ll be instances of |
53 // AutofillContact. | 55 // AutofillContact. |
54 assert selectedContact instanceof AutofillContact; | 56 assert selectedContact instanceof AutofillContact; |
55 mPaymentResponse.payerName = ((AutofillContact) selectedContact).get PayerName(); | 57 mPaymentResponse.payerName = ((AutofillContact) selectedContact).get PayerName(); |
56 mPaymentResponse.payerPhone = ((AutofillContact) selectedContact).ge tPayerPhone(); | 58 mPaymentResponse.payerPhone = ((AutofillContact) selectedContact).ge tPayerPhone(); |
57 mPaymentResponse.payerEmail = ((AutofillContact) selectedContact).ge tPayerEmail(); | 59 mPaymentResponse.payerEmail = ((AutofillContact) selectedContact).ge tPayerEmail(); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
118 | 120 |
119 // Wait for the payment details before sending the response. | 121 // Wait for the payment details before sending the response. |
120 if (!mIsWaitingForPaymentsDetails) mDelegate.onPaymentResponseReady(mPay mentResponse); | 122 if (!mIsWaitingForPaymentsDetails) mDelegate.onPaymentResponseReady(mPay mentResponse); |
121 } | 123 } |
122 | 124 |
123 @Override | 125 @Override |
124 public void onCouldNotNormalize(AutofillProfile profile) { | 126 public void onCouldNotNormalize(AutofillProfile profile) { |
125 onAddressNormalized(null); | 127 onAddressNormalized(null); |
126 } | 128 } |
127 } | 129 } |
OLD | NEW |