summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/Source/modules/notifications/NotificationEvent.h
blob: dfa1cf82d54a6dc210467250d3fcf2867ad27e9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef NotificationEvent_h
#define NotificationEvent_h

#include "modules/EventModules.h"
#include "modules/ModulesExport.h"
#include "modules/notifications/Notification.h"
#include "modules/serviceworkers/ExtendableEvent.h"
#include "platform/heap/Handle.h"

namespace blink {

class NotificationEventInit;

class MODULES_EXPORT NotificationEvent final : public ExtendableEvent {
    DEFINE_WRAPPERTYPEINFO();
public:
    static PassRefPtrWillBeRawPtr<NotificationEvent> create()
    {
        return adoptRefWillBeNoop(new NotificationEvent);
    }
    static PassRefPtrWillBeRawPtr<NotificationEvent> create(const AtomicString& type, const NotificationEventInit& initializer)
    {
        return adoptRefWillBeNoop(new NotificationEvent(type, initializer));
    }
    static PassRefPtrWillBeRawPtr<NotificationEvent> create(const AtomicString& type, const NotificationEventInit& initializer, WaitUntilObserver* observer)
    {
        return adoptRefWillBeNoop(new NotificationEvent(type, initializer, observer));
    }

    ~NotificationEvent() override;

    Notification* notification() const { return m_notification.get(); }
    String action() const { return m_action; }

    const AtomicString& interfaceName() const override;

    DECLARE_VIRTUAL_TRACE();

private:
    NotificationEvent();
    NotificationEvent(const AtomicString& type, const NotificationEventInit&);
    NotificationEvent(const AtomicString& type, const NotificationEventInit&, WaitUntilObserver*);

    PersistentWillBeMember<Notification> m_notification;
    String m_action;
};

} // namespace blink

#endif // NotificationEvent_h