chore: remove native_mate (Part 7) (#20561)
* refactor: use gin converters in api::Protocol * refactor: convert JS constructor impl to gin * refactor: use InitWithArgs helper * fix: gin_helper::Dictionary should behave the same with mate * fix cpplint warnings * refactor: no more need to patch gin/dictionary.h
This commit is contained in:
parent
6c6bff81ac
commit
1ecfcc8c70
43 changed files with 274 additions and 368 deletions
|
@ -9,6 +9,7 @@
|
|||
#include <string>
|
||||
|
||||
#include "base/callback.h"
|
||||
#include "gin/arguments.h"
|
||||
#include "shell/browser/api/atom_api_top_level_window.h"
|
||||
#include "shell/browser/api/trackable_object.h"
|
||||
#include "shell/browser/ui/atom_menu_model.h"
|
||||
|
@ -21,7 +22,7 @@ class Menu : public mate::TrackableObject<Menu>,
|
|||
public AtomMenuModel::Delegate,
|
||||
public AtomMenuModel::Observer {
|
||||
public:
|
||||
static mate::WrappableBase* New(mate::Arguments* args);
|
||||
static mate::WrappableBase* New(gin::Arguments* args);
|
||||
|
||||
static void BuildPrototype(v8::Isolate* isolate,
|
||||
v8::Local<v8::FunctionTemplate> prototype);
|
||||
|
@ -37,7 +38,7 @@ class Menu : public mate::TrackableObject<Menu>,
|
|||
AtomMenuModel* model() const { return model_.get(); }
|
||||
|
||||
protected:
|
||||
Menu(v8::Isolate* isolate, v8::Local<v8::Object> wrapper);
|
||||
explicit Menu(gin::Arguments* args);
|
||||
~Menu() override;
|
||||
|
||||
// mate::Wrappable:
|
||||
|
@ -144,31 +145,4 @@ struct Converter<electron::AtomMenuModel*> {
|
|||
|
||||
} // namespace mate
|
||||
|
||||
namespace gin {
|
||||
|
||||
template <>
|
||||
struct Converter<electron::AtomMenuModel*> {
|
||||
static bool FromV8(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> val,
|
||||
electron::AtomMenuModel** out) {
|
||||
return mate::ConvertFromV8(isolate, val, out);
|
||||
}
|
||||
};
|
||||
|
||||
// TODO(zcbenz): Remove this after converting Menu to gin::Wrapper.
|
||||
template <>
|
||||
struct Converter<electron::api::Menu*> {
|
||||
static bool FromV8(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> val,
|
||||
electron::api::Menu** out) {
|
||||
return mate::ConvertFromV8(isolate, val, out);
|
||||
}
|
||||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
electron::api::Menu* in) {
|
||||
return mate::ConvertToV8(isolate, in);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace gin
|
||||
|
||||
#endif // SHELL_BROWSER_API_ATOM_API_MENU_H_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue