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