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

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

Issue 2770193003: Implement request id in PaymentDetailsInit (Closed)
Patch Set: Rebase once more since mojom file moved Created 3 years, 8 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 1c2bbb0bc5a2292103b88b9795f95558de34174c..d245f9885f43d4a2d7ba8715c3d7d10840b7a551 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 "platform/wtf/HashSet.h"
#include "public/platform/InterfaceProvider.h"
@@ -536,6 +537,11 @@ void ValidateAndConvertPaymentDetailsInit(const PaymentDetailsInit& input,
return;
}
+ if (input.hasId())
+ output->id = input.id();
+ else
+ output->id = CreateCanonicalUUIDString();
+
ValidateAndConvertTotal(input.total(), output->total, exception_state);
}
@@ -880,6 +886,8 @@ PaymentRequest::PaymentRequest(ExecutionContext* execution_context,
if (exception_state.HadException())
return;
+ id_ = validated_details->id;
+
if (options_.requestShipping())
shipping_type_ = GetValidShippingType(options_.shippingType());
@@ -975,7 +983,7 @@ void PaymentRequest::OnPaymentResponse(PaymentResponsePtr response) {
complete_timer_.StartOneShot(kCompleteTimeoutSeconds, BLINK_FROM_HERE);
- show_resolver_->Resolve(new PaymentResponse(std::move(response), this));
+ show_resolver_->Resolve(new PaymentResponse(std::move(response), this, 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