Bug 1524687: Part 1 - Convert PaymentRequestModule to static manifest. r=edenchuang

Differential Revision: https://phabricator.services.mozilla.com/D18396

--HG--
extra : rebase_source : fd523c0f9572836541bfd29ba2a295df51f0c3fa
extra : source : 219b84a58f506a6b42d23f234e6a8f32e3c3da6c
This commit is contained in:
Kris Maglione 2019-01-24 15:14:54 -08:00
Родитель dbadd05b1e
Коммит e4ebc498c7
3 изменённых файлов: 84 добавлений и 113 удалений

Просмотреть файл

@ -1,112 +0,0 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/ModuleUtils.h"
#include "PaymentActionResponse.h"
#include "PaymentRequestData.h"
#include "PaymentRequestService.h"
using mozilla::dom::BasicCardMethodChangeDetails;
using mozilla::dom::BasicCardResponseData;
using mozilla::dom::GeneralMethodChangeDetails;
using mozilla::dom::GeneralResponseData;
using mozilla::dom::PaymentAbortActionResponse;
using mozilla::dom::PaymentCanMakeActionResponse;
using mozilla::dom::PaymentCompleteActionResponse;
using mozilla::dom::PaymentRequestService;
using mozilla::dom::PaymentShowActionResponse;
using mozilla::dom::payments::PaymentAddress;
NS_GENERIC_FACTORY_CONSTRUCTOR(GeneralResponseData)
NS_GENERIC_FACTORY_CONSTRUCTOR(BasicCardResponseData)
NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentCanMakeActionResponse)
NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentAbortActionResponse)
NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentShowActionResponse)
NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentCompleteActionResponse)
NS_GENERIC_FACTORY_CONSTRUCTOR(GeneralMethodChangeDetails)
NS_GENERIC_FACTORY_CONSTRUCTOR(BasicCardMethodChangeDetails)
NS_GENERIC_FACTORY_CONSTRUCTOR(PaymentAddress)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(PaymentRequestService,
PaymentRequestService::GetSingleton)
NS_DEFINE_NAMED_CID(NS_GENERAL_RESPONSE_DATA_CID);
NS_DEFINE_NAMED_CID(NS_BASICCARD_RESPONSE_DATA_CID);
NS_DEFINE_NAMED_CID(NS_PAYMENT_CANMAKE_ACTION_RESPONSE_CID);
NS_DEFINE_NAMED_CID(NS_PAYMENT_ABORT_ACTION_RESPONSE_CID);
NS_DEFINE_NAMED_CID(NS_PAYMENT_SHOW_ACTION_RESPONSE_CID);
NS_DEFINE_NAMED_CID(NS_PAYMENT_COMPLETE_ACTION_RESPONSE_CID);
NS_DEFINE_NAMED_CID(NS_GENERAL_CHANGE_DETAILS_CID);
NS_DEFINE_NAMED_CID(NS_BASICCARD_CHANGE_DETAILS_CID);
NS_DEFINE_NAMED_CID(NS_PAYMENT_ADDRESS_CID);
NS_DEFINE_NAMED_CID(NS_PAYMENT_REQUEST_SERVICE_CID);
static const mozilla::Module::CIDEntry kPaymentRequestCIDs[] = {
{&kNS_GENERAL_RESPONSE_DATA_CID, false, nullptr,
GeneralResponseDataConstructor},
{&kNS_BASICCARD_RESPONSE_DATA_CID, false, nullptr,
BasicCardResponseDataConstructor},
{&kNS_PAYMENT_CANMAKE_ACTION_RESPONSE_CID, false, nullptr,
PaymentCanMakeActionResponseConstructor},
{&kNS_PAYMENT_ABORT_ACTION_RESPONSE_CID, false, nullptr,
PaymentAbortActionResponseConstructor},
{&kNS_PAYMENT_SHOW_ACTION_RESPONSE_CID, false, nullptr,
PaymentShowActionResponseConstructor},
{&kNS_PAYMENT_COMPLETE_ACTION_RESPONSE_CID, false, nullptr,
PaymentCompleteActionResponseConstructor},
{&kNS_GENERAL_CHANGE_DETAILS_CID, false, nullptr,
GeneralMethodChangeDetailsConstructor},
{&kNS_BASICCARD_CHANGE_DETAILS_CID, false, nullptr,
BasicCardMethodChangeDetailsConstructor},
{&kNS_PAYMENT_ADDRESS_CID, false, nullptr, PaymentAddressConstructor},
{&kNS_PAYMENT_REQUEST_SERVICE_CID, true, nullptr,
PaymentRequestServiceConstructor},
{nullptr}};
static const mozilla::Module::ContractIDEntry kPaymentRequestContracts[] = {
{NS_GENERAL_RESPONSE_DATA_CONTRACT_ID, &kNS_GENERAL_RESPONSE_DATA_CID},
{NS_BASICCARD_RESPONSE_DATA_CONTRACT_ID, &kNS_BASICCARD_RESPONSE_DATA_CID},
{NS_PAYMENT_CANMAKE_ACTION_RESPONSE_CONTRACT_ID,
&kNS_PAYMENT_CANMAKE_ACTION_RESPONSE_CID},
{NS_PAYMENT_ABORT_ACTION_RESPONSE_CONTRACT_ID,
&kNS_PAYMENT_ABORT_ACTION_RESPONSE_CID},
{NS_PAYMENT_SHOW_ACTION_RESPONSE_CONTRACT_ID,
&kNS_PAYMENT_SHOW_ACTION_RESPONSE_CID},
{NS_PAYMENT_COMPLETE_ACTION_RESPONSE_CONTRACT_ID,
&kNS_PAYMENT_COMPLETE_ACTION_RESPONSE_CID},
{NS_GENERAL_CHANGE_DETAILS_CONTRACT_ID, &kNS_GENERAL_CHANGE_DETAILS_CID},
{NS_BASICCARD_CHANGE_DETAILS_CONTRACT_ID,
&kNS_BASICCARD_CHANGE_DETAILS_CID},
{NS_PAYMENT_ADDRESS_CONTRACT_ID, &kNS_PAYMENT_ADDRESS_CID},
{NS_PAYMENT_REQUEST_SERVICE_CONTRACT_ID, &kNS_PAYMENT_REQUEST_SERVICE_CID},
{nullptr}};
static const mozilla::Module::CategoryEntry kPaymentRequestCategories[] = {
{"payment-request", "GeneralResponseData",
NS_GENERAL_RESPONSE_DATA_CONTRACT_ID},
{"payment-request", "BasicCardResponseData",
NS_BASICCARD_RESPONSE_DATA_CONTRACT_ID},
{"payment-request", "PaymentCanMakeActionResponse",
NS_PAYMENT_CANMAKE_ACTION_RESPONSE_CONTRACT_ID},
{"payment-request", "PaymentAbortActionResponse",
NS_PAYMENT_ABORT_ACTION_RESPONSE_CONTRACT_ID},
{"payment-request", "PaymentShowActionResponse",
NS_PAYMENT_SHOW_ACTION_RESPONSE_CONTRACT_ID},
{"payment-request", "PaymentCompleteActionResponse",
NS_PAYMENT_COMPLETE_ACTION_RESPONSE_CONTRACT_ID},
{"payment-request", "GeneralMethodChangeDetails",
NS_GENERAL_CHANGE_DETAILS_CONTRACT_ID},
{"payment-request", "BasicCardMethodChangeDetails",
NS_BASICCARD_CHANGE_DETAILS_CONTRACT_ID},
{"payment-request", "PaymentAddress", NS_PAYMENT_ADDRESS_CONTRACT_ID},
{"payment-request", "PaymentRequestService",
NS_PAYMENT_REQUEST_SERVICE_CONTRACT_ID},
{nullptr}};
static const mozilla::Module kPaymentRequestModule = {
mozilla::Module::kVersion, kPaymentRequestCIDs, kPaymentRequestContracts,
kPaymentRequestCategories};
NSMODULE_DEFN(PaymentRequestModule) = &kPaymentRequestModule;

Просмотреть файл

@ -0,0 +1,80 @@
# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
Classes = [
{
'cid': '{5296f79e-15ea-40c3-8196-19cfa64d328c}',
'contract_ids': ['@mozilla.org/dom/payments/basiccard-change-details;1'],
'type': 'mozilla::dom::BasicCardMethodChangeDetails',
'headers': ['/dom/payments/PaymentActionResponse.h'],
'categories': {'payment-request': 'BasicCardMethodChangeDetails'},
},
{
'cid': '{0d55a5e6-d185-44f0-b992-a8e1321e4bce}',
'contract_ids': ['@mozilla.org/dom/payments/basiccard-response-data;1'],
'type': 'mozilla::dom::BasicCardResponseData',
'headers': ['/dom/payments/PaymentActionResponse.h'],
'categories': {'payment-request': 'BasicCardResponseData'},
},
{
'cid': '{e031267e-bec8-4f3c-b0b1-396b77ca260c}',
'contract_ids': ['@mozilla.org/dom/payments/general-change-details;1'],
'type': 'mozilla::dom::GeneralMethodChangeDetails',
'headers': ['/dom/payments/PaymentActionResponse.h'],
'categories': {'payment-request': 'GeneralMethodChangeDetails'},
},
{
'cid': '{b986773e-2b30-4ed2-b8fe-6a96631c8000}',
'contract_ids': ['@mozilla.org/dom/payments/general-response-data;1'],
'type': 'mozilla::dom::GeneralResponseData',
'headers': ['/dom/payments/PaymentActionResponse.h'],
'categories': {'payment-request': 'GeneralResponseData'},
},
{
'cid': '{8c72bcdb-0c37-4786-a9e5-510afa2f8ede}',
'contract_ids': ['@mozilla.org/dom/payments/payment-abort-action-response;1'],
'type': 'mozilla::dom::PaymentAbortActionResponse',
'headers': ['/dom/payments/PaymentActionResponse.h'],
'categories': {'payment-request': 'PaymentAbortActionResponse'},
},
{
'cid': '{49a02241-7e48-477a-9345-9f246925dcb3}',
'contract_ids': ['@mozilla.org/dom/payments/payment-address;1'],
'type': 'mozilla::dom::payments::PaymentAddress',
'headers': ['PaymentRequestData.h'],
'categories': {'payment-request': 'PaymentAddress'},
},
{
'cid': '{52fc3f9f-c0cb-4874-b3d4-ee4b6e9cbe9c}',
'contract_ids': ['@mozilla.org/dom/payments/payment-canmake-action-response;1'],
'type': 'mozilla::dom::PaymentCanMakeActionResponse',
'headers': ['/dom/payments/PaymentActionResponse.h'],
'categories': {'payment-request': 'PaymentCanMakeActionResponse'},
},
{
'cid': '{62c01e69-9ca4-4060-99e4-b95f628c8e6d}',
'contract_ids': ['@mozilla.org/dom/payments/payment-complete-action-response;1'],
'type': 'mozilla::dom::PaymentCompleteActionResponse',
'headers': ['/dom/payments/PaymentActionResponse.h'],
'categories': {'payment-request': 'PaymentCompleteActionResponse'},
},
{
'cid': '{cccd665f-edf3-41fc-ab9b-fc55b37340aa}',
'contract_ids': ['@mozilla.org/dom/payments/payment-request-service;1'],
'singleton': True,
'type': 'mozilla::dom::PaymentRequestService',
'headers': ['PaymentRequestService.h'],
'constructor': 'mozilla::dom::PaymentRequestService::GetSingleton',
'categories': {'payment-request': 'PaymentRequestService'},
},
{
'cid': '{184385cb-2d35-4b99-a9a3-7c780bf66b9b}',
'contract_ids': ['@mozilla.org/dom/payments/payment-show-action-response;1'],
'type': 'mozilla::dom::PaymentShowActionResponse',
'headers': ['/dom/payments/PaymentActionResponse.h'],
'categories': {'payment-request': 'PaymentShowActionResponse'},
},
]

Просмотреть файл

@ -32,13 +32,16 @@ UNIFIED_SOURCES += [
'PaymentRequest.cpp',
'PaymentRequestData.cpp',
'PaymentRequestManager.cpp',
'PaymentRequestModule.cpp',
'PaymentRequestService.cpp',
'PaymentRequestUpdateEvent.cpp',
'PaymentRequestUtils.cpp',
'PaymentResponse.cpp',
]
XPCOM_MANIFESTS += [
'components.conf',
]
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'