chore: remove native_mate (Part 14) (#21365)
* chore: remove uses of mate::Dictionary and mate::Handle * chore: move CreateConstructor to gin_helper * chore: remove native_mate * chore: remove unneeded gin patch
This commit is contained in:
parent
113b47d871
commit
0a741670a9
74 changed files with 215 additions and 2120 deletions
|
@ -6,9 +6,9 @@
|
|||
|
||||
#include <string>
|
||||
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "shell/browser/api/atom_api_view.h"
|
||||
#include "shell/common/api/constructor.h"
|
||||
#include "shell/common/gin_helper/constructor.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
namespace mate {
|
||||
|
@ -42,14 +42,15 @@ BoxLayout::BoxLayout(views::BoxLayout::Orientation orientation)
|
|||
|
||||
BoxLayout::~BoxLayout() {}
|
||||
|
||||
void BoxLayout::SetFlexForView(mate::Handle<View> view, int flex) {
|
||||
void BoxLayout::SetFlexForView(gin::Handle<View> view, int flex) {
|
||||
auto* box_layout = static_cast<views::BoxLayout*>(layout_manager());
|
||||
box_layout->SetFlexForView(view->view(), flex);
|
||||
}
|
||||
|
||||
// static
|
||||
mate::WrappableBase* BoxLayout::New(mate::Arguments* args,
|
||||
views::BoxLayout::Orientation orientation) {
|
||||
gin_helper::WrappableBase* BoxLayout::New(
|
||||
gin_helper::Arguments* args,
|
||||
views::BoxLayout::Orientation orientation) {
|
||||
auto* layout = new BoxLayout(orientation);
|
||||
layout->InitWith(args->isolate(), args->GetThis());
|
||||
return layout;
|
||||
|
@ -58,8 +59,8 @@ mate::WrappableBase* BoxLayout::New(mate::Arguments* args,
|
|||
// static
|
||||
void BoxLayout::BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype) {
|
||||
prototype->SetClassName(mate::StringToV8(isolate, "BoxLayout"));
|
||||
mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
|
||||
prototype->SetClassName(gin_helper::StringTov8(isolate, "BoxLayout"));
|
||||
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
|
||||
.SetMethod("setFlexForView", &BoxLayout::SetFlexForView);
|
||||
}
|
||||
|
||||
|
@ -76,8 +77,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("BoxLayout", mate::CreateConstructor<BoxLayout>(
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.Set("BoxLayout", gin_helper::CreateConstructor<BoxLayout>(
|
||||
isolate, base::BindRepeating(&BoxLayout::New)));
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#ifndef SHELL_BROWSER_API_VIEWS_ATOM_API_BOX_LAYOUT_H_
|
||||
#define SHELL_BROWSER_API_VIEWS_ATOM_API_BOX_LAYOUT_H_
|
||||
|
||||
#include "native_mate/handle.h"
|
||||
#include "gin/handle.h"
|
||||
#include "shell/browser/api/views/atom_api_layout_manager.h"
|
||||
#include "ui/views/layout/box_layout.h"
|
||||
|
||||
|
@ -17,13 +17,14 @@ class View;
|
|||
|
||||
class BoxLayout : public LayoutManager {
|
||||
public:
|
||||
static mate::WrappableBase* New(mate::Arguments* args,
|
||||
views::BoxLayout::Orientation orientation);
|
||||
static gin_helper::WrappableBase* New(
|
||||
gin_helper::Arguments* args,
|
||||
views::BoxLayout::Orientation orientation);
|
||||
|
||||
static void BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype);
|
||||
|
||||
void SetFlexForView(mate::Handle<View> view, int flex);
|
||||
void SetFlexForView(gin::Handle<View> view, int flex);
|
||||
|
||||
protected:
|
||||
explicit BoxLayout(views::BoxLayout::Orientation orientation);
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#include "shell/browser/api/views/atom_api_button.h"
|
||||
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "shell/common/api/constructor.h"
|
||||
#include "shell/common/gin_helper/constructor.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
namespace electron {
|
||||
|
@ -25,7 +25,7 @@ void Button::ButtonPressed(views::Button* sender, const ui::Event& event) {
|
|||
}
|
||||
|
||||
// static
|
||||
mate::WrappableBase* Button::New(mate::Arguments* args) {
|
||||
gin_helper::WrappableBase* Button::New(gin_helper::Arguments* args) {
|
||||
args->ThrowError("Button can not be created directly");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ mate::WrappableBase* Button::New(mate::Arguments* args) {
|
|||
// static
|
||||
void Button::BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype) {
|
||||
prototype->SetClassName(mate::StringToV8(isolate, "Button"));
|
||||
prototype->SetClassName(gin_helper::StringTov8(isolate, "Button"));
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
@ -49,8 +49,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("Button", mate::CreateConstructor<Button>(
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.Set("Button", gin_helper::CreateConstructor<Button>(
|
||||
isolate, base::BindRepeating(&Button::New)));
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#ifndef SHELL_BROWSER_API_VIEWS_ATOM_API_BUTTON_H_
|
||||
#define SHELL_BROWSER_API_VIEWS_ATOM_API_BUTTON_H_
|
||||
|
||||
#include "native_mate/handle.h"
|
||||
#include "gin/handle.h"
|
||||
#include "shell/browser/api/atom_api_view.h"
|
||||
#include "ui/views/controls/button/button.h"
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace api {
|
|||
|
||||
class Button : public View, public views::ButtonListener {
|
||||
public:
|
||||
static mate::WrappableBase* New(mate::Arguments* args);
|
||||
static gin_helper::WrappableBase* New(gin_helper::Arguments* args);
|
||||
|
||||
static void BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype);
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
#include "shell/browser/api/views/atom_api_label_button.h"
|
||||
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "shell/common/api/constructor.h"
|
||||
#include "shell/common/gin_helper/constructor.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
namespace electron {
|
||||
|
@ -37,8 +37,8 @@ void LabelButton::SetIsDefault(bool is_default) {
|
|||
}
|
||||
|
||||
// static
|
||||
mate::WrappableBase* LabelButton::New(mate::Arguments* args,
|
||||
const std::string& text) {
|
||||
gin_helper::WrappableBase* LabelButton::New(gin_helper::Arguments* args,
|
||||
const std::string& text) {
|
||||
// Constructor call.
|
||||
auto* view = new LabelButton(text);
|
||||
view->InitWith(args->isolate(), args->GetThis());
|
||||
|
@ -48,8 +48,8 @@ mate::WrappableBase* LabelButton::New(mate::Arguments* args,
|
|||
// static
|
||||
void LabelButton::BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype) {
|
||||
prototype->SetClassName(mate::StringToV8(isolate, "LabelButton"));
|
||||
mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
|
||||
prototype->SetClassName(gin_helper::StringTov8(isolate, "LabelButton"));
|
||||
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
|
||||
.SetMethod("getText", &LabelButton::GetText)
|
||||
.SetMethod("setText", &LabelButton::SetText)
|
||||
.SetMethod("isDefault", &LabelButton::IsDefault)
|
||||
|
@ -69,8 +69,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("LabelButton", mate::CreateConstructor<LabelButton>(
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.Set("LabelButton", gin_helper::CreateConstructor<LabelButton>(
|
||||
isolate, base::BindRepeating(&LabelButton::New)));
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ namespace api {
|
|||
|
||||
class LabelButton : public Button {
|
||||
public:
|
||||
static mate::WrappableBase* New(mate::Arguments* args,
|
||||
const std::string& text);
|
||||
static gin_helper::WrappableBase* New(gin_helper::Arguments* args,
|
||||
const std::string& text);
|
||||
|
||||
static void BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype);
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#include "shell/browser/api/views/atom_api_layout_manager.h"
|
||||
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "shell/common/api/constructor.h"
|
||||
#include "shell/common/gin_helper/constructor.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
namespace electron {
|
||||
|
@ -30,7 +30,7 @@ std::unique_ptr<views::LayoutManager> LayoutManager::TakeOver() {
|
|||
}
|
||||
|
||||
// static
|
||||
mate::WrappableBase* LayoutManager::New(mate::Arguments* args) {
|
||||
gin_helper::WrappableBase* LayoutManager::New(gin_helper::Arguments* args) {
|
||||
args->ThrowError("LayoutManager can not be created directly");
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -52,9 +52,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.Set("LayoutManager",
|
||||
mate::CreateConstructor<LayoutManager>(
|
||||
gin_helper::CreateConstructor<LayoutManager>(
|
||||
isolate, base::BindRepeating(&LayoutManager::New)));
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace api {
|
|||
|
||||
class LayoutManager : public gin_helper::TrackableObject<LayoutManager> {
|
||||
public:
|
||||
static mate::WrappableBase* New(mate::Arguments* args);
|
||||
static gin_helper::WrappableBase* New(gin_helper::Arguments* args);
|
||||
|
||||
static void BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype);
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
#include "shell/browser/api/views/atom_api_md_text_button.h"
|
||||
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "shell/common/api/constructor.h"
|
||||
#include "shell/common/gin_helper/constructor.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
namespace electron {
|
||||
|
@ -19,8 +19,8 @@ MdTextButton::MdTextButton(const std::string& text)
|
|||
MdTextButton::~MdTextButton() {}
|
||||
|
||||
// static
|
||||
mate::WrappableBase* MdTextButton::New(mate::Arguments* args,
|
||||
const std::string& text) {
|
||||
gin_helper::WrappableBase* MdTextButton::New(gin_helper::Arguments* args,
|
||||
const std::string& text) {
|
||||
// Constructor call.
|
||||
auto* view = new MdTextButton(text);
|
||||
view->InitWith(args->isolate(), args->GetThis());
|
||||
|
@ -30,7 +30,7 @@ mate::WrappableBase* MdTextButton::New(mate::Arguments* args,
|
|||
// static
|
||||
void MdTextButton::BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype) {
|
||||
prototype->SetClassName(mate::StringToV8(isolate, "MdTextButton"));
|
||||
prototype->SetClassName(gin_helper::StringTov8(isolate, "MdTextButton"));
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
@ -46,9 +46,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.Set("MdTextButton",
|
||||
mate::CreateConstructor<MdTextButton>(
|
||||
gin_helper::CreateConstructor<MdTextButton>(
|
||||
isolate, base::BindRepeating(&MdTextButton::New)));
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ namespace api {
|
|||
|
||||
class MdTextButton : public LabelButton {
|
||||
public:
|
||||
static mate::WrappableBase* New(mate::Arguments* args,
|
||||
const std::string& text);
|
||||
static gin_helper::WrappableBase* New(gin_helper::Arguments* args,
|
||||
const std::string& text);
|
||||
|
||||
static void BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype);
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#include "shell/browser/api/views/atom_api_resize_area.h"
|
||||
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "shell/common/api/constructor.h"
|
||||
#include "shell/common/gin_helper/constructor.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
namespace electron {
|
||||
|
@ -23,7 +23,7 @@ void ResizeArea::OnResize(int resize_amount, bool done_resizing) {
|
|||
}
|
||||
|
||||
// static
|
||||
mate::WrappableBase* ResizeArea::New(mate::Arguments* args) {
|
||||
gin_helper::WrappableBase* ResizeArea::New(gin_helper::Arguments* args) {
|
||||
// Constructor call.
|
||||
auto* view = new ResizeArea();
|
||||
view->InitWith(args->isolate(), args->GetThis());
|
||||
|
@ -33,7 +33,7 @@ mate::WrappableBase* ResizeArea::New(mate::Arguments* args) {
|
|||
// static
|
||||
void ResizeArea::BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype) {
|
||||
prototype->SetClassName(mate::StringToV8(isolate, "ResizeArea"));
|
||||
prototype->SetClassName(gin_helper::StringTov8(isolate, "ResizeArea"));
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
@ -49,8 +49,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("ResizeArea", mate::CreateConstructor<ResizeArea>(
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.Set("ResizeArea", gin_helper::CreateConstructor<ResizeArea>(
|
||||
isolate, base::BindRepeating(&ResizeArea::New)));
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#ifndef SHELL_BROWSER_API_VIEWS_ATOM_API_RESIZE_AREA_H_
|
||||
#define SHELL_BROWSER_API_VIEWS_ATOM_API_RESIZE_AREA_H_
|
||||
|
||||
#include "native_mate/handle.h"
|
||||
#include "gin/handle.h"
|
||||
#include "shell/browser/api/atom_api_view.h"
|
||||
#include "ui/views/controls/resize_area.h"
|
||||
#include "ui/views/controls/resize_area_delegate.h"
|
||||
|
@ -16,7 +16,7 @@ namespace api {
|
|||
|
||||
class ResizeArea : public View, protected views::ResizeAreaDelegate {
|
||||
public:
|
||||
static mate::WrappableBase* New(mate::Arguments* args);
|
||||
static gin_helper::WrappableBase* New(gin_helper::Arguments* args);
|
||||
|
||||
static void BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype);
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
|
||||
#include "shell/browser/api/views/atom_api_text_field.h"
|
||||
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "shell/common/api/constructor.h"
|
||||
#include "shell/common/gin_helper/constructor.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
namespace electron {
|
||||
|
@ -27,7 +27,7 @@ base::string16 TextField::GetText() const {
|
|||
}
|
||||
|
||||
// static
|
||||
mate::WrappableBase* TextField::New(mate::Arguments* args) {
|
||||
gin_helper::WrappableBase* TextField::New(gin_helper::Arguments* args) {
|
||||
// Constructor call.
|
||||
auto* view = new TextField();
|
||||
view->InitWith(args->isolate(), args->GetThis());
|
||||
|
@ -37,8 +37,8 @@ mate::WrappableBase* TextField::New(mate::Arguments* args) {
|
|||
// static
|
||||
void TextField::BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype) {
|
||||
prototype->SetClassName(mate::StringToV8(isolate, "TextField"));
|
||||
mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
|
||||
prototype->SetClassName(gin_helper::StringTov8(isolate, "TextField"));
|
||||
gin_helper::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
|
||||
.SetMethod("setText", &TextField::SetText)
|
||||
.SetMethod("getText", &TextField::GetText);
|
||||
}
|
||||
|
@ -56,8 +56,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
mate::Dictionary dict(isolate, exports);
|
||||
dict.Set("TextField", mate::CreateConstructor<TextField>(
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.Set("TextField", gin_helper::CreateConstructor<TextField>(
|
||||
isolate, base::BindRepeating(&TextField::New)));
|
||||
}
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#ifndef SHELL_BROWSER_API_VIEWS_ATOM_API_TEXT_FIELD_H_
|
||||
#define SHELL_BROWSER_API_VIEWS_ATOM_API_TEXT_FIELD_H_
|
||||
|
||||
#include "native_mate/handle.h"
|
||||
#include "gin/handle.h"
|
||||
#include "shell/browser/api/atom_api_view.h"
|
||||
#include "ui/views/controls/textfield/textfield.h"
|
||||
|
||||
|
@ -15,7 +15,7 @@ namespace api {
|
|||
|
||||
class TextField : public View {
|
||||
public:
|
||||
static mate::WrappableBase* New(mate::Arguments* args);
|
||||
static gin_helper::WrappableBase* New(gin_helper::Arguments* args);
|
||||
|
||||
static void BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue