OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NotificationEvent_h | 5 #ifndef NotificationEvent_h |
6 #define NotificationEvent_h | 6 #define NotificationEvent_h |
7 | 7 |
8 #include "modules/EventModules.h" | 8 #include "modules/EventModules.h" |
9 #include "modules/notifications/Notification.h" | 9 #include "modules/notifications/Notification.h" |
10 #include "modules/serviceworkers/ExtendableEvent.h" | 10 #include "modules/serviceworkers/ExtendableEvent.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 struct NotificationEventInit : public EventInit { | 15 struct NotificationEventInit : public ExtendableEventInit { |
16 NotificationEventInit(); | 16 NotificationEventInit(); |
17 | 17 |
18 Member<Notification> notification; | 18 Member<Notification> notification; |
19 }; | 19 }; |
20 | 20 |
21 class NotificationEvent final : public ExtendableEvent { | 21 class NotificationEvent final : public ExtendableEvent { |
22 DEFINE_WRAPPERTYPEINFO(); | 22 DEFINE_WRAPPERTYPEINFO(); |
23 public: | 23 public: |
24 static PassRefPtrWillBeRawPtr<NotificationEvent> create() | 24 static PassRefPtrWillBeRawPtr<NotificationEvent> create() |
25 { | 25 { |
26 return adoptRefWillBeNoop(new NotificationEvent); | 26 return adoptRefWillBeNoop(new NotificationEvent); |
27 } | 27 } |
| 28 static PassRefPtrWillBeRawPtr<NotificationEvent> create(const AtomicString&
type, const NotificationEventInit& initializer) |
| 29 { |
| 30 return adoptRefWillBeNoop(new NotificationEvent(type, initializer)); |
| 31 } |
28 static PassRefPtrWillBeRawPtr<NotificationEvent> create(const AtomicString&
type, const NotificationEventInit& initializer, WaitUntilObserver* observer) | 32 static PassRefPtrWillBeRawPtr<NotificationEvent> create(const AtomicString&
type, const NotificationEventInit& initializer, WaitUntilObserver* observer) |
29 { | 33 { |
30 return adoptRefWillBeNoop(new NotificationEvent(type, initializer, obser
ver)); | 34 return adoptRefWillBeNoop(new NotificationEvent(type, initializer, obser
ver)); |
31 } | 35 } |
32 | 36 |
33 ~NotificationEvent() override; | 37 ~NotificationEvent() override; |
34 | 38 |
35 Notification* notification() const { return m_notification.get(); } | 39 Notification* notification() const { return m_notification.get(); } |
36 | 40 |
37 const AtomicString& interfaceName() const override; | 41 const AtomicString& interfaceName() const override; |
38 | 42 |
39 void trace(Visitor*) override; | 43 void trace(Visitor*) override; |
40 | 44 |
41 private: | 45 private: |
42 NotificationEvent(); | 46 NotificationEvent(); |
| 47 NotificationEvent(const AtomicString& type, const NotificationEventInit&); |
43 NotificationEvent(const AtomicString& type, const NotificationEventInit&, Wa
itUntilObserver*); | 48 NotificationEvent(const AtomicString& type, const NotificationEventInit&, Wa
itUntilObserver*); |
44 | 49 |
45 PersistentWillBeMember<Notification> m_notification; | 50 PersistentWillBeMember<Notification> m_notification; |
46 }; | 51 }; |
47 | 52 |
48 } // namespace blink | 53 } // namespace blink |
49 | 54 |
50 #endif // NotificationEvent_h | 55 #endif // NotificationEvent_h |
OLD | NEW |