#include "third_party/blink/renderer/modules/payments/goods/digital_goods_service.h"
#include <type_traits>
#include <utility>
#include "base/check.h"
#include "components/digital_goods/mojom/digital_goods.mojom-blink.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/struct_ptr.h"
#include "mojo/public/cpp/bindings/type_converter.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/core/dom/dom_exception.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h"
#include "third_party/blink/renderer/modules/payments/goods/digital_goods_type_converters.h"
#include "third_party/blink/renderer/platform/bindings/exception_code.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/bindings/v8_throw_exception.h"
#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/member.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"
namespace blink {
class ItemDetails;
class PurchaseDetails;
BillingResponseCode;
namespace {
void OnGetDetailsResponse(
ScriptPromiseResolver<IDLSequence<ItemDetails>>* resolver,
BillingResponseCode code,
Vector<payments::mojom::blink::ItemDetailsPtr> item_details_list) { … }
void ResolveWithPurchaseReferenceList(
ScriptPromiseResolver<IDLSequence<PurchaseDetails>>* resolver,
BillingResponseCode code,
Vector<payments::mojom::blink::PurchaseReferencePtr>
purchase_reference_list) { … }
void OnConsumeResponse(ScriptPromiseResolver<IDLUndefined>* resolver,
BillingResponseCode code) { … }
}
DigitalGoodsService::DigitalGoodsService(
ExecutionContext* context,
mojo::PendingRemote<payments::mojom::blink::DigitalGoods> pending_remote)
: … { … }
DigitalGoodsService::~DigitalGoodsService() = default;
ScriptPromise<IDLSequence<ItemDetails>> DigitalGoodsService::getDetails(
ScriptState* script_state,
const Vector<String>& item_ids) { … }
ScriptPromise<IDLSequence<PurchaseDetails>> DigitalGoodsService::listPurchases(
ScriptState* script_state) { … }
ScriptPromise<IDLSequence<PurchaseDetails>>
DigitalGoodsService::listPurchaseHistory(ScriptState* script_state) { … }
ScriptPromise<IDLUndefined> DigitalGoodsService::consume(
ScriptState* script_state,
const String& purchase_token) { … }
void DigitalGoodsService::Trace(Visitor* visitor) const { … }
}