OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 SensorErrorEvent_h | 5 #ifndef SensorErrorEvent_h |
6 #define SensorErrorEvent_h | 6 #define SensorErrorEvent_h |
7 | 7 |
8 #include "core/events/ErrorEvent.h" | 8 #include "core/dom/DOMException.h" |
9 #include "modules/EventModules.h" | 9 #include "modules/EventModules.h" |
10 #include "modules/sensor/SensorErrorEventInit.h" | 10 #include "modules/sensor/SensorErrorEventInit.h" |
11 #include "platform/heap/Handle.h" | 11 #include "platform/heap/Handle.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class SensorErrorEvent : public Event { | 15 class SensorErrorEvent : public Event { |
16 DEFINE_WRAPPERTYPEINFO(); | 16 DEFINE_WRAPPERTYPEINFO(); |
17 | 17 |
18 public: | 18 public: |
19 static SensorErrorEvent* create(const AtomicString& eventType) { | 19 static SensorErrorEvent* create(const AtomicString& eventType, |
20 return new SensorErrorEvent(eventType); | 20 DOMException* error) { |
| 21 return new SensorErrorEvent(eventType, error); |
21 } | 22 } |
22 | 23 |
23 static SensorErrorEvent* create(const AtomicString& eventType, | 24 static SensorErrorEvent* create(const AtomicString& eventType, |
24 const SensorErrorEventInit& initializer) { | 25 const SensorErrorEventInit& initializer) { |
25 return new SensorErrorEvent(eventType, initializer); | 26 return new SensorErrorEvent(eventType, initializer); |
26 } | 27 } |
27 | 28 |
28 ~SensorErrorEvent() override; | 29 ~SensorErrorEvent() override; |
29 | 30 |
30 DECLARE_VIRTUAL_TRACE(); | 31 DECLARE_VIRTUAL_TRACE(); |
31 | 32 |
32 const AtomicString& interfaceName() const override; | 33 const AtomicString& interfaceName() const override; |
33 | 34 |
34 explicit SensorErrorEvent(const AtomicString& eventType); | 35 DOMException* error() { return m_error; } |
| 36 |
| 37 private: |
| 38 SensorErrorEvent(const AtomicString& eventType, DOMException* error); |
35 SensorErrorEvent(const AtomicString& eventType, | 39 SensorErrorEvent(const AtomicString& eventType, |
36 const SensorErrorEventInit& initializer); | 40 const SensorErrorEventInit& initializer); |
| 41 |
| 42 Member<DOMException> m_error; |
37 }; | 43 }; |
38 | 44 |
39 DEFINE_TYPE_CASTS(SensorErrorEvent, | 45 DEFINE_TYPE_CASTS(SensorErrorEvent, |
40 Event, | 46 Event, |
41 event, | 47 event, |
42 event->interfaceName() == EventNames::SensorErrorEvent, | 48 event->interfaceName() == EventNames::SensorErrorEvent, |
43 event.interfaceName() == EventNames::SensorErrorEvent); | 49 event.interfaceName() == EventNames::SensorErrorEvent); |
44 | 50 |
45 } // namepsace blink | 51 } // namepsace blink |
46 | 52 |
47 #endif // SensorErrorEvent_h | 53 #endif // SensorErrorEvent_h |
OLD | NEW |