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

Unified Diff: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp

Issue 2770193003: Implement request id in PaymentDetailsInit (Closed)
Patch Set: Add comment in mojom Created 3 years, 9 months 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
Index: third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
diff --git a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
index 63e221476b9c5d4619f63e40ddda08f1023310d6..5d97c965b1612f40a6aa3840feae480908387dc0 100644
--- a/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
+++ b/third_party/WebKit/Source/modules/payments/PaymentRequest.cpp
@@ -39,6 +39,7 @@
#include "modules/payments/PaymentsValidators.h"
#include "mojo/public/cpp/bindings/interface_request.h"
#include "platform/RuntimeEnabledFeatures.h"
+#include "platform/UUID.h"
#include "platform/mojo/MojoHelper.h"
#include "public/platform/InterfaceProvider.h"
#include "public/platform/Platform.h"
@@ -521,6 +522,11 @@ void validateAndConvertPaymentDetailsInit(const PaymentDetailsInit& input,
return;
}
+ if (input.hasId())
+ output->id = input.id();
+ else
+ output->id = createCanonicalUUIDString();
+
validateAndConvertTotal(input.total(), output->total, exceptionState);
}
@@ -883,6 +889,8 @@ PaymentRequest::PaymentRequest(ExecutionContext* executionContext,
if (exceptionState.hadException())
return;
+ m_id = validatedDetails->id;
+
if (m_options.requestShipping())
m_shippingType = getValidShippingType(m_options.shippingType());
@@ -978,7 +986,7 @@ void PaymentRequest::OnPaymentResponse(PaymentResponsePtr response) {
m_completeTimer.startOneShot(completeTimeoutSeconds, BLINK_FROM_HERE);
- m_showResolver->resolve(new PaymentResponse(std::move(response), this));
+ m_showResolver->resolve(new PaymentResponse(std::move(response), this, m_id));
// Do not close the mojo connection here. The merchant website should call
// PaymentResponse::complete(String), which will be forwarded over the mojo

Powered by Google App Engine
This is Rietveld 408576698