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:
Cheng Zhao 2019-12-05 18:46:34 +09:00 committed by GitHub
parent 113b47d871
commit 0a741670a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
74 changed files with 215 additions and 2120 deletions

View file

@ -90,8 +90,8 @@ void BrowserView::WebContentsDestroyed() {
}
// static
mate::WrappableBase* BrowserView::New(gin_helper::ErrorThrower thrower,
gin::Arguments* args) {
gin_helper::WrappableBase* BrowserView::New(gin_helper::ErrorThrower thrower,
gin::Arguments* args) {
if (!Browser::Get()->is_ready()) {
thrower.ThrowError("Cannot create BrowserView before app is ready");
return nullptr;

View file

@ -33,8 +33,8 @@ class WebContents;
class BrowserView : public gin_helper::TrackableObject<BrowserView>,
public content::WebContentsObserver {
public:
static mate::WrappableBase* New(gin_helper::ErrorThrower thrower,
gin::Arguments* args);
static gin_helper::WrappableBase* New(gin_helper::ErrorThrower thrower,
gin::Arguments* args);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);

View file

@ -16,9 +16,9 @@
#include "shell/browser/unresponsive_suppressor.h"
#include "shell/browser/web_contents_preferences.h"
#include "shell/browser/window_list.h"
#include "shell/common/api/constructor.h"
#include "shell/common/color_util.h"
#include "shell/common/gin_converters/value_converter.h"
#include "shell/common/gin_helper/constructor.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/node_includes.h"
@ -445,8 +445,8 @@ void BrowserWindow::OnWindowHide() {
}
// static
mate::WrappableBase* BrowserWindow::New(gin_helper::ErrorThrower thrower,
gin::Arguments* args) {
gin_helper::WrappableBase* BrowserWindow::New(gin_helper::ErrorThrower thrower,
gin::Arguments* args) {
if (!Browser::Get()->is_ready()) {
thrower.ThrowError("Cannot create BrowserWindow before app is ready");
return nullptr;
@ -502,7 +502,7 @@ void Initialize(v8::Local<v8::Object> exports,
v8::Isolate* isolate = context->GetIsolate();
gin_helper::Dictionary dict(isolate, exports);
dict.Set("BrowserWindow",
mate::CreateConstructor<BrowserWindow>(
gin_helper::CreateConstructor<BrowserWindow>(
isolate, base::BindRepeating(&BrowserWindow::New)));
}

View file

@ -23,8 +23,8 @@ class BrowserWindow : public TopLevelWindow,
public content::WebContentsObserver,
public ExtendedWebContentsObserver {
public:
static mate::WrappableBase* New(gin_helper::ErrorThrower thrower,
gin::Arguments* args);
static gin_helper::WrappableBase* New(gin_helper::ErrorThrower thrower,
gin::Arguments* args);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);

View file

@ -22,7 +22,7 @@ class Menu : public gin_helper::TrackableObject<Menu>,
public AtomMenuModel::Delegate,
public AtomMenuModel::Observer {
public:
static mate::WrappableBase* New(gin::Arguments* args);
static gin_helper::WrappableBase* New(gin::Arguments* args);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);
@ -41,7 +41,7 @@ class Menu : public gin_helper::TrackableObject<Menu>,
explicit Menu(gin::Arguments* args);
~Menu() override;
// mate::Wrappable:
// gin_helper::Wrappable:
void AfterInit(v8::Isolate* isolate) override;
// ui::SimpleMenuModel::Delegate:
@ -150,17 +150,4 @@ struct Converter<electron::AtomMenuModel*> {
} // namespace gin
namespace mate {
template <>
struct Converter<electron::AtomMenuModel*> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
electron::AtomMenuModel** out) {
return gin::ConvertFromV8(isolate, val, out);
}
};
} // namespace mate
#endif // SHELL_BROWSER_API_ATOM_API_MENU_H_

View file

@ -177,7 +177,7 @@ void Menu::SendActionToFirstResponder(const std::string& action) {
}
// static
mate::WrappableBase* Menu::New(gin::Arguments* args) {
gin_helper::WrappableBase* Menu::New(gin::Arguments* args) {
return new MenuMac(args);
}

View file

@ -84,7 +84,7 @@ void MenuViews::OnClosed(int32_t window_id, base::OnceClosure callback) {
}
// static
mate::WrappableBase* Menu::New(gin::Arguments* args) {
gin_helper::WrappableBase* Menu::New(gin::Arguments* args) {
return new MenuViews(args);
}

View file

@ -5,13 +5,13 @@
#ifndef SHELL_BROWSER_API_ATOM_API_NET_H_
#define SHELL_BROWSER_API_ATOM_API_NET_H_
#include "native_mate/wrappable.h"
#include "shell/common/gin_helper/wrappable.h"
namespace electron {
namespace api {
class Net : public mate::Wrappable<Net> {
class Net : public gin_helper::Wrappable<Net> {
public:
static v8::Local<v8::Value> Create(v8::Isolate* isolate);

View file

@ -80,8 +80,8 @@ Notification::~Notification() {
}
// static
mate::WrappableBase* Notification::New(gin_helper::ErrorThrower thrower,
gin::Arguments* args) {
gin_helper::WrappableBase* Notification::New(gin_helper::ErrorThrower thrower,
gin::Arguments* args) {
if (!Browser::Get()->is_ready()) {
thrower.ThrowError("Cannot create Notification before app is ready");
return nullptr;

View file

@ -28,8 +28,8 @@ namespace api {
class Notification : public gin_helper::TrackableObject<Notification>,
public NotificationDelegate {
public:
static mate::WrappableBase* New(gin_helper::ErrorThrower thrower,
gin::Arguments* args);
static gin_helper::WrappableBase* New(gin_helper::ErrorThrower thrower,
gin::Arguments* args);
static bool IsSupported();
static void BuildPrototype(v8::Isolate* isolate,

View file

@ -216,7 +216,7 @@ void DestroyGlobalHandle(v8::Isolate* isolate,
void* ptr = object->GetAlignedPointerFromInternalField(0);
if (!ptr)
return;
delete static_cast<mate::WrappableBase*>(ptr);
delete static_cast<gin_helper::WrappableBase*>(ptr);
object->SetAlignedPointerInInternalField(0, nullptr);
}
}

View file

@ -108,7 +108,7 @@ class Session : public gin_helper::TrackableObject<Session>,
download::DownloadItem* item) override;
private:
// Cached mate::Wrappable objects.
// Cached gin_helper::Wrappable objects.
v8::Global<v8::Value> cookies_;
v8::Global<v8::Value> protocol_;
v8::Global<v8::Value> net_log_;

View file

@ -1055,7 +1055,7 @@ void TopLevelWindow::RemoveFromParentChildWindows() {
}
// static
mate::WrappableBase* TopLevelWindow::New(gin_helper::Arguments* args) {
gin_helper::WrappableBase* TopLevelWindow::New(gin_helper::Arguments* args) {
gin_helper::Dictionary options =
gin::Dictionary::CreateEmpty(args->isolate());
args->GetNext(&options);

View file

@ -28,7 +28,7 @@ class View;
class TopLevelWindow : public gin_helper::TrackableObject<TopLevelWindow>,
public NativeWindowObserver {
public:
static mate::WrappableBase* New(gin_helper::Arguments* args);
static gin_helper::WrappableBase* New(gin_helper::Arguments* args);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);

View file

@ -65,9 +65,9 @@ Tray::Tray(gin::Handle<NativeImage> image, gin_helper::Arguments* args)
Tray::~Tray() = default;
// static
mate::WrappableBase* Tray::New(gin_helper::ErrorThrower thrower,
gin::Handle<NativeImage> image,
gin_helper::Arguments* args) {
gin_helper::WrappableBase* Tray::New(gin_helper::ErrorThrower thrower,
gin::Handle<NativeImage> image,
gin_helper::Arguments* args) {
if (!Browser::Get()->is_ready()) {
thrower.ThrowError("Cannot create Tray before app is ready");
return nullptr;

View file

@ -34,9 +34,9 @@ class NativeImage;
class Tray : public gin_helper::TrackableObject<Tray>, public TrayIconObserver {
public:
static mate::WrappableBase* New(gin_helper::ErrorThrower thrower,
gin::Handle<NativeImage> image,
gin_helper::Arguments* args);
static gin_helper::WrappableBase* New(gin_helper::ErrorThrower thrower,
gin::Handle<NativeImage> image,
gin_helper::Arguments* args);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);

View file

@ -318,7 +318,7 @@ void SimpleURLLoaderWrapper::Cancel() {
}
// static
mate::WrappableBase* SimpleURLLoaderWrapper::New(gin::Arguments* args) {
gin_helper::WrappableBase* SimpleURLLoaderWrapper::New(gin::Arguments* args) {
gin_helper::Dictionary opts;
if (!args->GetNext(&opts)) {
args->ThrowTypeError("Expected a dictionary");

View file

@ -38,7 +38,7 @@ class SimpleURLLoaderWrapper
public network::SimpleURLLoaderStreamConsumer {
public:
~SimpleURLLoaderWrapper() override;
static mate::WrappableBase* New(gin::Arguments* args);
static gin_helper::WrappableBase* New(gin::Arguments* args);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);

View file

@ -43,7 +43,7 @@ void View::AddChildViewAt(gin::Handle<View> child, size_t index) {
#endif
// static
mate::WrappableBase* View::New(gin::Arguments* args) {
gin_helper::WrappableBase* View::New(gin::Arguments* args) {
auto* view = new View();
view->InitWithArgs(args);
return view;

View file

@ -19,7 +19,7 @@ namespace api {
class View : public gin_helper::TrackableObject<View> {
public:
static mate::WrappableBase* New(gin::Arguments* args);
static gin_helper::WrappableBase* New(gin::Arguments* args);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);

View file

@ -8,7 +8,7 @@
#include "shell/browser/api/atom_api_web_contents.h"
#include "shell/browser/browser.h"
#include "shell/browser/ui/inspectable_web_contents_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"
@ -79,7 +79,7 @@ void WebContentsView::WebContentsDestroyed() {
}
// static
mate::WrappableBase* WebContentsView::New(
gin_helper::WrappableBase* WebContentsView::New(
gin_helper::Arguments* args,
gin::Handle<WebContents> web_contents) {
// Currently we only support InspectableWebContents, e.g. the WebContents
@ -121,7 +121,7 @@ void Initialize(v8::Local<v8::Object> exports,
v8::Isolate* isolate = context->GetIsolate();
gin_helper::Dictionary dict(isolate, exports);
dict.Set("WebContentsView",
mate::CreateConstructor<WebContentsView>(
gin_helper::CreateConstructor<WebContentsView>(
isolate, base::BindRepeating(&WebContentsView::New)));
}

View file

@ -18,8 +18,8 @@ class WebContents;
class WebContentsView : public View, public content::WebContentsObserver {
public:
static mate::WrappableBase* New(gin_helper::Arguments* args,
gin::Handle<WebContents> web_contents);
static gin_helper::WrappableBase* New(gin_helper::Arguments* args,
gin::Handle<WebContents> web_contents);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);

View file

@ -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)));
}

View file

@ -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);

View file

@ -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)));
}

View file

@ -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);

View file

@ -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)));
}

View file

@ -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);

View file

@ -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)));
}

View file

@ -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);

View file

@ -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)));
}

View file

@ -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);

View file

@ -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)));
}

View file

@ -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);

View file

@ -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)));
}

View file

@ -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);