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/notifications/NotificationEvent.h" | 6 #include "modules/notifications/NotificationEvent.h" |
7 #include "wtf/text/WTFString.h" | |
8 | 7 |
9 namespace blink { | 8 namespace blink { |
10 | 9 |
11 NotificationEvent::NotificationEvent() | 10 NotificationEvent::NotificationEvent() { } |
12 : m_action(emptyString()) | |
13 { | |
14 } | |
15 | 11 |
16 NotificationEvent::NotificationEvent(const AtomicString& type, const Notificatio nEventInit& initializer) | 12 NotificationEvent::NotificationEvent(const AtomicString& type, const Notificatio nEventInit& initializer) |
17 : ExtendableEvent(type, initializer) | 13 : ExtendableEvent(type, initializer) |
Peter Beverloo
2015/08/07 07:25:25
Use a delegated constructor w/ observer==nullptr?
| |
18 , m_action(initializer.action()) | |
19 { | 14 { |
20 if (initializer.hasNotification()) | 15 if (initializer.hasNotification()) |
21 m_notification = initializer.notification(); | 16 m_notification = initializer.notification(); |
17 if (initializer.hasAction()) | |
Peter Beverloo
2015/08/07 07:25:25
You explicitly used "emptyString()" before, now we
| |
18 m_action = initializer.action(); | |
22 } | 19 } |
23 | 20 |
24 NotificationEvent::NotificationEvent(const AtomicString& type, const Notificatio nEventInit& initializer, WaitUntilObserver* observer) | 21 NotificationEvent::NotificationEvent(const AtomicString& type, const Notificatio nEventInit& initializer, WaitUntilObserver* observer) |
25 : ExtendableEvent(type, initializer, observer) | 22 : ExtendableEvent(type, initializer, observer) |
26 , m_action(initializer.action()) | |
27 { | 23 { |
28 if (initializer.hasNotification()) | 24 if (initializer.hasNotification()) |
29 m_notification = initializer.notification(); | 25 m_notification = initializer.notification(); |
26 if (initializer.hasAction()) | |
27 m_action = initializer.action(); | |
30 } | 28 } |
31 | 29 |
32 NotificationEvent::~NotificationEvent() | 30 NotificationEvent::~NotificationEvent() |
33 { | 31 { |
34 } | 32 } |
35 | 33 |
36 const AtomicString& NotificationEvent::interfaceName() const | 34 const AtomicString& NotificationEvent::interfaceName() const |
37 { | 35 { |
38 return EventNames::NotificationEvent; | 36 return EventNames::NotificationEvent; |
39 } | 37 } |
40 | 38 |
41 DEFINE_TRACE(NotificationEvent) | 39 DEFINE_TRACE(NotificationEvent) |
42 { | 40 { |
43 visitor->trace(m_notification); | 41 visitor->trace(m_notification); |
44 ExtendableEvent::trace(visitor); | 42 ExtendableEvent::trace(visitor); |
45 } | 43 } |
46 | 44 |
47 } // namespace blink | 45 } // namespace blink |
OLD | NEW |