refactor: ginify InAppPurchase (#24674)

This commit is contained in:
Jeremy Rose 2020-07-23 14:55:41 -07:00 committed by GitHub
parent 5cfe956fe1
commit 071c5930b9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 22 deletions

View file

@ -9,26 +9,31 @@
#include <vector>
#include "gin/handle.h"
#include "gin/wrappable.h"
#include "shell/browser/event_emitter_mixin.h"
#include "shell/browser/mac/in_app_purchase.h"
#include "shell/browser/mac/in_app_purchase_observer.h"
#include "shell/browser/mac/in_app_purchase_product.h"
#include "shell/common/gin_helper/event_emitter.h"
#include "shell/common/gin_helper/promise.h"
#include "v8/include/v8.h"
namespace electron {
namespace api {
class InAppPurchase : public gin_helper::EventEmitter<InAppPurchase>,
class InAppPurchase : public gin::Wrappable<InAppPurchase>,
public gin_helper::EventEmitterMixin<InAppPurchase>,
public in_app_purchase::TransactionObserver {
public:
static gin::Handle<InAppPurchase> Create(v8::Isolate* isolate);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);
// gin::Wrappable
static gin::WrapperInfo kWrapperInfo;
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;
const char* GetTypeName() override;
protected:
explicit InAppPurchase(v8::Isolate* isolate);
InAppPurchase();
~InAppPurchase() override;
v8::Local<v8::Promise> PurchaseProduct(const std::string& product_id,