chore: remove native_mate (Part 12) (#20869)

* refactor: move mate::Event to gin

* refactor: move mate::Locker to gin

* refactor: convert contextBridge to gin

* refactor: convert contentTracing to gin

* refactor: remove callback converter of native_mate

* refactor: remove file_dialog_converter and native_window_converter from native_mate

* refactor: convert webFrame to gin

* refactor: move blink_converter to gin

* refactor: remove net_converter from native_mate

* refactor: remove event_emitter_caller_deprecated

* refactor: remove gurl_converter from native_mate

* refactor: remove file_path and string16_converter from native_mate

* refactor: remove image_converter from native_mate

* refactor: move value_converter to gin
This commit is contained in:
Cheng Zhao 2019-10-31 16:56:00 +09:00 committed by GitHub
parent 6781d5e3c8
commit 3ae3233e65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
96 changed files with 622 additions and 1711 deletions

View file

@ -5,27 +5,26 @@
#ifndef SHELL_BROWSER_API_EVENT_H_
#define SHELL_BROWSER_API_EVENT_H_
#include "base/optional.h"
#include "electron/shell/common/api/api.mojom.h"
#include "native_mate/handle.h"
#include "native_mate/wrappable.h"
#include "gin/handle.h"
#include "gin/wrappable.h"
namespace IPC {
class Message;
}
namespace mate {
namespace gin_helper {
class Event : public Wrappable<Event> {
class Event : public gin::Wrappable<Event> {
public:
using InvokeCallback = electron::mojom::ElectronBrowser::InvokeCallback;
static Handle<Event> Create(v8::Isolate* isolate);
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);
static gin::WrapperInfo kWrapperInfo;
static gin::Handle<Event> Create(v8::Isolate* isolate);
// Pass the callback to be invoked.
void SetCallback(base::Optional<InvokeCallback> callback);
void SetCallback(InvokeCallback callback);
// event.PreventDefault().
void PreventDefault(v8::Isolate* isolate);
@ -35,16 +34,21 @@ class Event : public Wrappable<Event> {
bool SendReply(v8::Isolate* isolate, v8::Local<v8::Value> result);
protected:
explicit Event(v8::Isolate* isolate);
Event();
~Event() override;
// gin::Wrappable:
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;
const char* GetTypeName() override;
private:
// Replyer for the synchronous messages.
base::Optional<InvokeCallback> callback_;
InvokeCallback callback_;
DISALLOW_COPY_AND_ASSIGN(Event);
};
} // namespace mate
} // namespace gin_helper
#endif // SHELL_BROWSER_API_EVENT_H_