OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "content/renderer/service_worker/service_worker_type_converters.h" | 5 #include "content/renderer/service_worker/service_worker_type_converters.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace mojo { | 9 namespace mojo { |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 blink::WebPaymentAppRequest | 32 blink::WebPaymentAppRequest |
33 TypeConverter<blink::WebPaymentAppRequest, | 33 TypeConverter<blink::WebPaymentAppRequest, |
34 payments::mojom::PaymentAppRequestPtr>:: | 34 payments::mojom::PaymentAppRequestPtr>:: |
35 Convert(const payments::mojom::PaymentAppRequestPtr& input) { | 35 Convert(const payments::mojom::PaymentAppRequestPtr& input) { |
36 blink::WebPaymentAppRequest output; | 36 blink::WebPaymentAppRequest output; |
37 | 37 |
38 output.origin = blink::WebString::FromUTF8(input->origin.spec()); | 38 output.origin = blink::WebString::FromUTF8(input->origin.spec()); |
39 | 39 |
40 output.method_data = | 40 output.method_data = |
41 blink::WebVector<blink::WebPaymentMethodData>(input->methodData.size()); | 41 blink::WebVector<blink::WebPaymentMethodData>(input->method_data.size()); |
42 for (size_t i = 0; i < input->methodData.size(); i++) { | 42 for (size_t i = 0; i < input->method_data.size(); i++) { |
43 output.method_data[i] = mojo::ConvertTo<blink::WebPaymentMethodData>( | 43 output.method_data[i] = mojo::ConvertTo<blink::WebPaymentMethodData>( |
44 std::move(input->methodData[i])); | 44 std::move(input->method_data[i])); |
45 } | 45 } |
46 | 46 |
47 output.total = mojo::ConvertTo<blink::WebPaymentItem>(input->total); | 47 output.total = mojo::ConvertTo<blink::WebPaymentItem>(input->total); |
48 | 48 |
49 output.modifiers = blink::WebVector<blink::WebPaymentDetailsModifier>( | 49 output.modifiers = blink::WebVector<blink::WebPaymentDetailsModifier>( |
50 input->modifiers.size()); | 50 input->modifiers.size()); |
51 for (size_t i = 0; i < input->modifiers.size(); i++) { | 51 for (size_t i = 0; i < input->modifiers.size(); i++) { |
52 output.modifiers[i] = | 52 output.modifiers[i] = |
53 mojo::ConvertTo<blink::WebPaymentDetailsModifier>(input->modifiers[i]); | 53 mojo::ConvertTo<blink::WebPaymentDetailsModifier>(input->modifiers[i]); |
54 } | 54 } |
55 | 55 |
56 output.option_id = blink::WebString::FromUTF8(input->optionId); | 56 output.option_id = blink::WebString::FromUTF8(input->option_id); |
57 | 57 |
58 return output; | 58 return output; |
59 } | 59 } |
60 | 60 |
61 blink::WebPaymentMethodData | 61 blink::WebPaymentMethodData |
62 TypeConverter<blink::WebPaymentMethodData, | 62 TypeConverter<blink::WebPaymentMethodData, |
63 payments::mojom::PaymentMethodDataPtr>:: | 63 payments::mojom::PaymentMethodDataPtr>:: |
64 Convert(const payments::mojom::PaymentMethodDataPtr& input) { | 64 Convert(const payments::mojom::PaymentMethodDataPtr& input) { |
65 blink::WebPaymentMethodData output; | 65 blink::WebPaymentMethodData output; |
66 | 66 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 kSucceeded; | 139 kSucceeded; |
140 case content::mojom::BackgroundFetchState::FAILED: | 140 case content::mojom::BackgroundFetchState::FAILED: |
141 return blink::WebServiceWorkerContextProxy::BackgroundFetchState::kFailed; | 141 return blink::WebServiceWorkerContextProxy::BackgroundFetchState::kFailed; |
142 } | 142 } |
143 | 143 |
144 NOTREACHED(); | 144 NOTREACHED(); |
145 return blink::WebServiceWorkerContextProxy::BackgroundFetchState::kPending; | 145 return blink::WebServiceWorkerContextProxy::BackgroundFetchState::kPending; |
146 } | 146 } |
147 | 147 |
148 } // namespace mojo | 148 } // namespace mojo |
OLD | NEW |