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:
Cheng Zhao 2019-10-15 10:15:23 +09:00 committed by GitHub
parent 6c6bff81ac
commit 1ecfcc8c70
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 274 additions and 368 deletions

View file

@ -14,6 +14,7 @@
#include "shell/browser/notifications/notification.h"
#include "shell/browser/notifications/notification_delegate.h"
#include "shell/browser/notifications/notification_presenter.h"
#include "shell/common/gin_helper/error_thrower.h"
#include "ui/gfx/image/image.h"
namespace gin {
@ -27,7 +28,8 @@ namespace api {
class Notification : public mate::TrackableObject<Notification>,
public NotificationDelegate {
public:
static mate::WrappableBase* New(mate::Arguments* args);
static mate::WrappableBase* New(gin_helper::ErrorThrower thrower,
gin::Arguments* args);
static bool IsSupported();
static void BuildPrototype(v8::Isolate* isolate,
@ -42,7 +44,7 @@ class Notification : public mate::TrackableObject<Notification>,
void NotificationClosed() override;
protected:
Notification(v8::Local<v8::Object> wrapper, gin::Arguments* args);
explicit Notification(gin::Arguments* args);
~Notification() override;
void Show();
@ -101,22 +103,4 @@ class Notification : public mate::TrackableObject<Notification>,
} // namespace electron
namespace gin {
// TODO(zcbenz): Remove this after converting Notification to gin::Wrapper.
template <>
struct Converter<electron::api::Notification*> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
electron::api::Notification** out) {
return mate::ConvertFromV8(isolate, val, out);
}
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
electron::api::Notification* in) {
return mate::ConvertToV8(isolate, in);
}
};
} // namespace gin
#endif // SHELL_BROWSER_API_ATOM_API_NOTIFICATION_H_