refactor: ginify NativeImage (#24486)

This commit is contained in:
Jeremy Rose 2020-07-13 14:44:12 -07:00 committed by GitHub
parent f0a0e10bd1
commit 36bd940bc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 56 additions and 28 deletions

View file

@ -11,8 +11,8 @@
#include "base/values.h"
#include "gin/handle.h"
#include "gin/wrappable.h"
#include "shell/common/gin_helper/error_thrower.h"
#include "shell/common/gin_helper/wrappable.h"
#include "ui/gfx/image/image.h"
#if defined(OS_WIN)
@ -35,11 +35,15 @@ namespace gin_helper {
class Dictionary;
}
namespace gin {
class Arguments;
}
namespace electron {
namespace api {
class NativeImage : public gin_helper::Wrappable<NativeImage> {
class NativeImage : public gin::Wrappable<NativeImage> {
public:
static gin::Handle<NativeImage> CreateEmpty(v8::Isolate* isolate);
static gin::Handle<NativeImage> Create(v8::Isolate* isolate,
@ -65,8 +69,13 @@ class NativeImage : public gin_helper::Wrappable<NativeImage> {
static gin::Handle<NativeImage> CreateFromNamedImage(gin::Arguments* args,
std::string name);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);
static v8::Local<v8::FunctionTemplate> GetConstructor(v8::Isolate* isolate);
// gin::Wrappable
static gin::WrapperInfo kWrapperInfo;
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;
const char* GetTypeName() override;
#if defined(OS_WIN)
HICON GetHICON(int size);
@ -109,6 +118,8 @@ class NativeImage : public gin_helper::Wrappable<NativeImage> {
gfx::Image image_;
v8::Isolate* isolate_;
DISALLOW_COPY_AND_ASSIGN(NativeImage);
};