Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #include "mozilla/ModuleUtils.h"
8 : #include "PaymentActionRequest.h"
9 : #include "PaymentActionResponse.h"
10 : #include "PaymentRequestData.h"
11 : #include "PaymentRequestService.h"
12 :
13 : using mozilla::dom::PaymentActionRequest;
14 : using mozilla::dom::PaymentCreateActionRequest;
15 : using mozilla::dom::PaymentCompleteActionRequest;
16 : using mozilla::dom::PaymentUpdateActionRequest;
17 : using mozilla::dom::PaymentCanMakeActionResponse;
18 : using mozilla::dom::PaymentAbortActionResponse;
19 : using mozilla::dom::PaymentShowActionResponse;
20 : using mozilla::dom::PaymentCompleteActionResponse;
21 : using mozilla::dom::payments::PaymentAddress;
22 : using mozilla::dom::PaymentRequestService;
23 :
24 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentActionRequest)
25 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentCreateActionRequest)
26 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentCompleteActionRequest)
27 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentUpdateActionRequest)
28 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentCanMakeActionResponse)
29 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentAbortActionResponse)
30 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentShowActionResponse)
31 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentCompleteActionResponse)
32 0 : NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentAddress)
33 0 : NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(PaymentRequestService,
34 : PaymentRequestService::GetSingleton)
35 :
36 : NS_DEFINE_NAMED_CID(NS_PAYMENT_ACTION_REQUEST_CID);
37 : NS_DEFINE_NAMED_CID(NS_PAYMENT_CREATE_ACTION_REQUEST_CID);
38 : NS_DEFINE_NAMED_CID(NS_PAYMENT_COMPLETE_ACTION_REQUEST_CID);
39 : NS_DEFINE_NAMED_CID(NS_PAYMENT_UPDATE_ACTION_REQUEST_CID);
40 : NS_DEFINE_NAMED_CID(NS_PAYMENT_CANMAKE_ACTION_RESPONSE_CID);
41 : NS_DEFINE_NAMED_CID(NS_PAYMENT_ABORT_ACTION_RESPONSE_CID);
42 : NS_DEFINE_NAMED_CID(NS_PAYMENT_SHOW_ACTION_RESPONSE_CID);
43 : NS_DEFINE_NAMED_CID(NS_PAYMENT_COMPLETE_ACTION_RESPONSE_CID);
44 : NS_DEFINE_NAMED_CID(NS_PAYMENT_ADDRESS_CID);
45 : NS_DEFINE_NAMED_CID(NS_PAYMENT_REQUEST_SERVICE_CID);
46 :
47 : static const mozilla::Module::CIDEntry kPaymentRequestCIDs[] = {
48 : { &kNS_PAYMENT_ACTION_REQUEST_CID, false, nullptr, PaymentActionRequestConstructor},
49 : { &kNS_PAYMENT_CREATE_ACTION_REQUEST_CID, false, nullptr, PaymentCreateActionRequestConstructor},
50 : { &kNS_PAYMENT_COMPLETE_ACTION_REQUEST_CID, false, nullptr, PaymentCompleteActionRequestConstructor},
51 : { &kNS_PAYMENT_UPDATE_ACTION_REQUEST_CID, false, nullptr, PaymentUpdateActionRequestConstructor},
52 : { &kNS_PAYMENT_CANMAKE_ACTION_RESPONSE_CID, false, nullptr, PaymentCanMakeActionResponseConstructor},
53 : { &kNS_PAYMENT_ABORT_ACTION_RESPONSE_CID, false, nullptr, PaymentAbortActionResponseConstructor},
54 : { &kNS_PAYMENT_SHOW_ACTION_RESPONSE_CID, false, nullptr, PaymentShowActionResponseConstructor},
55 : { &kNS_PAYMENT_COMPLETE_ACTION_RESPONSE_CID, false, nullptr, PaymentCompleteActionResponseConstructor},
56 : { &kNS_PAYMENT_ADDRESS_CID, false, nullptr, PaymentAddressConstructor},
57 : { &kNS_PAYMENT_REQUEST_SERVICE_CID, true, nullptr, PaymentRequestServiceConstructor },
58 : { nullptr }
59 : };
60 :
61 : static const mozilla::Module::ContractIDEntry kPaymentRequestContracts[] = {
62 : { NS_PAYMENT_ACTION_REQUEST_CONTRACT_ID, &kNS_PAYMENT_ACTION_REQUEST_CID },
63 : { NS_PAYMENT_CREATE_ACTION_REQUEST_CONTRACT_ID, &kNS_PAYMENT_CREATE_ACTION_REQUEST_CID },
64 : { NS_PAYMENT_COMPLETE_ACTION_REQUEST_CONTRACT_ID, &kNS_PAYMENT_COMPLETE_ACTION_REQUEST_CID },
65 : { NS_PAYMENT_UPDATE_ACTION_REQUEST_CONTRACT_ID, &kNS_PAYMENT_UPDATE_ACTION_REQUEST_CID },
66 : { NS_PAYMENT_CANMAKE_ACTION_RESPONSE_CONTRACT_ID, &kNS_PAYMENT_CANMAKE_ACTION_RESPONSE_CID },
67 : { NS_PAYMENT_ABORT_ACTION_RESPONSE_CONTRACT_ID, &kNS_PAYMENT_ABORT_ACTION_RESPONSE_CID },
68 : { NS_PAYMENT_SHOW_ACTION_RESPONSE_CONTRACT_ID, &kNS_PAYMENT_SHOW_ACTION_RESPONSE_CID },
69 : { NS_PAYMENT_COMPLETE_ACTION_RESPONSE_CONTRACT_ID, &kNS_PAYMENT_COMPLETE_ACTION_RESPONSE_CID },
70 : { NS_PAYMENT_ADDRESS_CONTRACT_ID, &kNS_PAYMENT_ADDRESS_CID },
71 : { NS_PAYMENT_REQUEST_SERVICE_CONTRACT_ID, &kNS_PAYMENT_REQUEST_SERVICE_CID },
72 : { nullptr }
73 : };
74 :
75 : static const mozilla::Module::CategoryEntry kPaymentRequestCategories[] = {
76 : { "payment-request", "PaymentActionRequest", NS_PAYMENT_ACTION_REQUEST_CONTRACT_ID },
77 : { "payment-request", "PaymentCreateActionRequest", NS_PAYMENT_CREATE_ACTION_REQUEST_CONTRACT_ID },
78 : { "payment-request", "PaymentCompleteActionRequest", NS_PAYMENT_COMPLETE_ACTION_REQUEST_CONTRACT_ID },
79 : { "payment-request", "PaymentUpdateActionRequest", NS_PAYMENT_UPDATE_ACTION_REQUEST_CONTRACT_ID },
80 : { "payment-request", "PaymentCanMakeActionResponse", NS_PAYMENT_CANMAKE_ACTION_RESPONSE_CONTRACT_ID },
81 : { "payment-request", "PaymentAbortActionResponse", NS_PAYMENT_ABORT_ACTION_RESPONSE_CONTRACT_ID },
82 : { "payment-request", "PaymentShowActionResponse", NS_PAYMENT_SHOW_ACTION_RESPONSE_CONTRACT_ID },
83 : { "payment-request", "PaymentCompleteActionResponse", NS_PAYMENT_COMPLETE_ACTION_RESPONSE_CONTRACT_ID },
84 : { "payment-request", "PaymentAddress", NS_PAYMENT_ADDRESS_CONTRACT_ID },
85 : { "payment-request", "PaymentRequestService", NS_PAYMENT_REQUEST_SERVICE_CONTRACT_ID },
86 : { nullptr }
87 : };
88 :
89 : static const mozilla::Module kPaymentRequestModule = {
90 : mozilla::Module::kVersion,
91 : kPaymentRequestCIDs,
92 : kPaymentRequestContracts,
93 : kPaymentRequestCategories
94 : };
95 :
96 : NSMODULE_DEFN(PaymentRequestModule) = &kPaymentRequestModule;
|