Index: content/common/service_worker/service_worker_type_converters.cc |
diff --git a/content/common/service_worker/service_worker_type_converters.cc b/content/common/service_worker/service_worker_type_converters.cc |
index dccda08bd6794b593f2e6b1f1f33e93027685bc1..e54bbe90a0b05bb30ff875cc4377fbf0512ad662 100644 |
--- a/content/common/service_worker/service_worker_type_converters.cc |
+++ b/content/common/service_worker/service_worker_type_converters.cc |
@@ -29,4 +29,101 @@ TypeConverter<content::ServiceWorkerStatusCode, |
return status_code; |
} |
+blink::WebPaymentAppRequest |
+TypeConverter<blink::WebPaymentAppRequest, |
+ payments::mojom::PaymentAppRequestPtr>:: |
+ Convert(const payments::mojom::PaymentAppRequestPtr& input) { |
+ blink::WebPaymentAppRequest output; |
+ |
+ output.origin = blink::WebString::fromUTF8(input->origin.spec()); |
+ |
+ output.methodData = |
+ blink::WebVector<blink::WebPaymentMethodData>(input->methodData.size()); |
+ for (size_t i = 0; i < input->methodData.size(); i++) { |
+ output.methodData[i] = mojo::ConvertTo<blink::WebPaymentMethodData>( |
+ std::move(input->methodData[i])); |
+ } |
+ |
+ output.total = mojo::ConvertTo<blink::WebPaymentItem>(input->total); |
+ |
+ output.modifiers = blink::WebVector<blink::WebPaymentDetailsModifier>( |
+ input->modifiers.size()); |
+ for (size_t i = 0; i < input->modifiers.size(); i++) { |
+ output.modifiers[i] = |
+ mojo::ConvertTo<blink::WebPaymentDetailsModifier>(input->modifiers[i]); |
+ } |
+ |
+ output.optionId = blink::WebString::fromUTF8(input->optionId); |
+ |
+ return output; |
+} |
+ |
+blink::WebPaymentMethodData |
+TypeConverter<blink::WebPaymentMethodData, |
+ payments::mojom::PaymentMethodDataPtr>:: |
+ Convert(const payments::mojom::PaymentMethodDataPtr& input) { |
+ blink::WebPaymentMethodData output; |
+ |
+ output.supportedMethods = |
+ blink::WebVector<blink::WebString>(input->supported_methods.size()); |
+ for (size_t i = 0; i < input->supported_methods.size(); i++) { |
+ output.supportedMethods[i] = |
+ blink::WebString::fromUTF8(input->supported_methods[i]); |
+ } |
+ |
+ output.stringifiedData = blink::WebString::fromUTF8(input->stringified_data); |
+ |
+ return output; |
+} |
+ |
+blink::WebPaymentItem |
+TypeConverter<blink::WebPaymentItem, payments::mojom::PaymentItemPtr>::Convert( |
+ const payments::mojom::PaymentItemPtr& input) { |
+ blink::WebPaymentItem output; |
+ output.label = blink::WebString::fromUTF8(input->label); |
+ output.amount = |
+ mojo::ConvertTo<blink::WebPaymentCurrencyAmount>(input->amount); |
+ output.pending = input->pending; |
+ return output; |
+} |
+ |
+blink::WebPaymentCurrencyAmount |
+TypeConverter<blink::WebPaymentCurrencyAmount, |
+ payments::mojom::PaymentCurrencyAmountPtr>:: |
+ Convert(const payments::mojom::PaymentCurrencyAmountPtr& input) { |
+ blink::WebPaymentCurrencyAmount output; |
+ output.currency = blink::WebString::fromUTF8(input->currency); |
+ output.value = blink::WebString::fromUTF8(input->value); |
+ output.currencySystem = blink::WebString::fromUTF8(input->currency_system); |
+ return output; |
+} |
+ |
+blink::WebPaymentDetailsModifier |
+TypeConverter<blink::WebPaymentDetailsModifier, |
+ payments::mojom::PaymentDetailsModifierPtr>:: |
+ Convert(const payments::mojom::PaymentDetailsModifierPtr& input) { |
+ blink::WebPaymentDetailsModifier output; |
+ |
+ output.supportedMethods = blink::WebVector<blink::WebString>( |
+ input->method_data->supported_methods.size()); |
+ for (size_t i = 0; i < input->method_data->supported_methods.size(); i++) { |
+ output.supportedMethods[i] = |
+ blink::WebString::fromUTF8(input->method_data->supported_methods[i]); |
+ } |
+ |
+ output.total = mojo::ConvertTo<blink::WebPaymentItem>(input->total); |
+ |
+ output.additionalDisplayItems = blink::WebVector<blink::WebPaymentItem>( |
+ input->additional_display_items.size()); |
+ for (size_t i = 0; i < input->additional_display_items.size(); i++) { |
+ output.additionalDisplayItems[i] = mojo::ConvertTo<blink::WebPaymentItem>( |
+ input->additional_display_items[i]); |
+ } |
+ |
+ output.stringifiedData = |
+ blink::WebString::fromUTF8(input->method_data->stringified_data); |
+ |
+ return output; |
+} |
+ |
} // namespace |