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 #include "config.h" | 5 #include "config.h" |
6 #include "modules/push_messaging/PushEvent.h" | 6 #include "modules/push_messaging/PushEvent.h" |
7 | 7 |
| 8 #include "modules/push_messaging/PushEventInit.h" |
| 9 |
8 namespace blink { | 10 namespace blink { |
9 | 11 |
10 PushEvent::PushEvent() | 12 PushEvent::PushEvent() |
11 { | 13 { |
12 } | 14 } |
13 | 15 |
14 PushEvent::PushEvent(const AtomicString& type, PushMessageData* data, WaitUntilO
bserver* observer) | 16 PushEvent::PushEvent(const AtomicString& type, PushMessageData* data, WaitUntilO
bserver* observer) |
15 : ExtendableEvent(type, ExtendableEventInit(), observer) | 17 : ExtendableEvent(type, ExtendableEventInit(), observer) |
16 , m_data(data) | 18 , m_data(data) |
17 { | 19 { |
18 } | 20 } |
19 | 21 |
20 PushEvent::PushEvent(const AtomicString& type, const PushEventInit& initializer) | 22 PushEvent::PushEvent(const AtomicString& type, const PushEventInit& initializer) |
21 : ExtendableEvent(type, initializer) | 23 : ExtendableEvent(type, initializer) |
22 { | 24 { |
23 if (initializer.hasData()) | 25 if (initializer.hasData()) |
24 m_data = initializer.data(); | 26 m_data = PushMessageData::create(initializer.data()); |
25 } | 27 } |
26 | 28 |
27 PushEvent::~PushEvent() | 29 PushEvent::~PushEvent() |
28 { | 30 { |
29 } | 31 } |
30 | 32 |
31 const AtomicString& PushEvent::interfaceName() const | 33 const AtomicString& PushEvent::interfaceName() const |
32 { | 34 { |
33 return EventNames::PushEvent; | 35 return EventNames::PushEvent; |
34 } | 36 } |
35 | 37 |
36 PushMessageData* PushEvent::data() | 38 PushMessageData* PushEvent::data() |
37 { | 39 { |
38 if (!m_data) | 40 if (!m_data) |
39 m_data = PushMessageData::create(); | 41 m_data = PushMessageData::create(); |
40 | 42 |
41 return m_data.get(); | 43 return m_data.get(); |
42 } | 44 } |
43 | 45 |
44 DEFINE_TRACE(PushEvent) | 46 DEFINE_TRACE(PushEvent) |
45 { | 47 { |
46 visitor->trace(m_data); | 48 visitor->trace(m_data); |
47 ExtendableEvent::trace(visitor); | 49 ExtendableEvent::trace(visitor); |
48 } | 50 } |
49 | 51 |
50 } // namespace blink | 52 } // namespace blink |
OLD | NEW |