|
@@ -10,6 +10,7 @@
|
|
|
|
|
|
#include "shell/common/gin_helper/dictionary.h"
|
|
|
#include "shell/common/gin_helper/object_template_builder.h"
|
|
|
+#include "shell/common/gin_helper/promise.h"
|
|
|
#include "shell/common/node_includes.h"
|
|
|
|
|
|
namespace gin {
|
|
@@ -73,17 +74,18 @@ namespace electron {
|
|
|
|
|
|
namespace api {
|
|
|
|
|
|
+gin::WrapperInfo InAppPurchase::kWrapperInfo = {gin::kEmbedderNativeGin};
|
|
|
+
|
|
|
#if defined(OS_MACOSX)
|
|
|
// static
|
|
|
gin::Handle<InAppPurchase> InAppPurchase::Create(v8::Isolate* isolate) {
|
|
|
- return gin::CreateHandle(isolate, new InAppPurchase(isolate));
|
|
|
+ return gin::CreateHandle(isolate, new InAppPurchase());
|
|
|
}
|
|
|
|
|
|
-// static
|
|
|
-void InAppPurchase::BuildPrototype(v8::Isolate* isolate,
|
|
|
- v8::Local<v8::FunctionTemplate> prototype) {
|
|
|
- prototype->SetClassName(gin::StringToV8(isolate, "InAppPurchase"));
|
|
|
- gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
|
|
|
+gin::ObjectTemplateBuilder InAppPurchase::GetObjectTemplateBuilder(
|
|
|
+ v8::Isolate* isolate) {
|
|
|
+ return gin_helper::EventEmitterMixin<InAppPurchase>::GetObjectTemplateBuilder(
|
|
|
+ isolate)
|
|
|
.SetMethod("canMakePayments", &in_app_purchase::CanMakePayments)
|
|
|
.SetMethod("restoreCompletedTransactions",
|
|
|
&in_app_purchase::RestoreCompletedTransactions)
|
|
@@ -96,10 +98,12 @@ void InAppPurchase::BuildPrototype(v8::Isolate* isolate,
|
|
|
.SetMethod("getProducts", &InAppPurchase::GetProducts);
|
|
|
}
|
|
|
|
|
|
-InAppPurchase::InAppPurchase(v8::Isolate* isolate) {
|
|
|
- Init(isolate);
|
|
|
+const char* InAppPurchase::GetTypeName() {
|
|
|
+ return "InAppPurchase";
|
|
|
}
|
|
|
|
|
|
+InAppPurchase::InAppPurchase() {}
|
|
|
+
|
|
|
InAppPurchase::~InAppPurchase() {}
|
|
|
|
|
|
v8::Local<v8::Promise> InAppPurchase::PurchaseProduct(
|
|
@@ -158,9 +162,6 @@ void Initialize(v8::Local<v8::Object> exports,
|
|
|
v8::Isolate* isolate = context->GetIsolate();
|
|
|
gin_helper::Dictionary dict(isolate, exports);
|
|
|
dict.Set("inAppPurchase", InAppPurchase::Create(isolate));
|
|
|
- dict.Set("InAppPurchase", InAppPurchase::GetConstructor(isolate)
|
|
|
- ->GetFunction(context)
|
|
|
- .ToLocalChecked());
|
|
|
#endif
|
|
|
}
|
|
|
|