| Index: components/payments/content/payment_request.cc
|
| diff --git a/components/payments/content/payment_request.cc b/components/payments/content/payment_request.cc
|
| index 15aee2c679179aa5b8350baa43e647edde7dd14a..cfa5a9f639aa465e9fe77a70fc0f6a176dbd1160 100644
|
| --- a/components/payments/content/payment_request.cc
|
| +++ b/components/payments/content/payment_request.cc
|
| @@ -14,6 +14,10 @@
|
| #include "content/public/browser/web_contents.h"
|
|
|
| namespace payments {
|
| +namespace {
|
| +// When waiting for an UpdateWith call, timeout after 60 seconds.
|
| +constexpr int kTimeoutDuration = 60;
|
| +} // namespace
|
|
|
| PaymentRequest::PaymentRequest(
|
| content::WebContents* web_contents,
|
| @@ -79,6 +83,7 @@ void PaymentRequest::UpdateWith(mojom::PaymentDetailsPtr details) {
|
| OnConnectionTerminated();
|
| return;
|
| }
|
| + wait_timer_.Stop();
|
| spec_->UpdateWith(std::move(details));
|
| }
|
|
|
| @@ -125,11 +130,21 @@ void PaymentRequest::OnPaymentResponseAvailable(
|
|
|
| void PaymentRequest::OnShippingOptionIdSelected(
|
| std::string shipping_option_id) {
|
| + // TODO(anthonyvd): display an error before terminating the connection.
|
| + wait_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(kTimeoutDuration),
|
| + this, &PaymentRequest::OnConnectionTerminated);
|
| + spec_->StartWaitingForUpdateWith(
|
| + PaymentRequestSpec::UpdateReason::SHIPPING_OPTION);
|
| client_->OnShippingOptionChange(shipping_option_id);
|
| }
|
|
|
| void PaymentRequest::OnShippingAddressSelected(
|
| mojom::PaymentAddressPtr address) {
|
| + // TODO(anthonyvd): display an error before terminating the connection.
|
| + wait_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(kTimeoutDuration),
|
| + this, &PaymentRequest::OnConnectionTerminated);
|
| + spec_->StartWaitingForUpdateWith(
|
| + PaymentRequestSpec::UpdateReason::SHIPPING_ADDRESS);
|
| client_->OnShippingAddressChange(std::move(address));
|
| }
|
|
|
|
|