refactor: ginify Notification (#22821)

This commit is contained in:
Jeremy Apthorp 2020-03-31 11:42:32 -07:00 committed by GitHub
parent 629465aac7
commit 765c08c600
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 68 additions and 30 deletions

View file

@ -10,30 +10,40 @@
#include <vector>
#include "base/strings/utf_string_conversions.h"
#include "gin/wrappable.h"
#include "shell/browser/event_emitter_mixin.h"
#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/cleaned_up_at_exit.h"
#include "shell/common/gin_helper/constructible.h"
#include "shell/common/gin_helper/error_thrower.h"
#include "shell/common/gin_helper/trackable_object.h"
#include "ui/gfx/image/image.h"
namespace gin {
class Arguments;
}
template <typename T>
class Handle;
} // namespace gin
namespace electron {
namespace api {
class Notification : public gin_helper::TrackableObject<Notification>,
class Notification : public gin::Wrappable<Notification>,
public gin_helper::EventEmitterMixin<Notification>,
public gin_helper::Constructible<Notification>,
public gin_helper::CleanedUpAtExit,
public NotificationDelegate {
public:
static gin_helper::WrappableBase* New(gin_helper::ErrorThrower thrower,
gin::Arguments* args);
static bool IsSupported();
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);
// gin_helper::Constructible
static gin::Handle<Notification> New(gin_helper::ErrorThrower thrower,
gin::Arguments* args);
static v8::Local<v8::ObjectTemplate> FillObjectTemplate(
v8::Isolate*,
v8::Local<v8::ObjectTemplate>);
// NotificationDelegate:
void NotificationAction(int index) override;
@ -43,6 +53,9 @@ class Notification : public gin_helper::TrackableObject<Notification>,
void NotificationDestroyed() override;
void NotificationClosed() override;
// gin::Wrappable
static gin::WrapperInfo kWrapperInfo;
protected:
explicit Notification(gin::Arguments* args);
~Notification() override;