OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef SensorReadingEvent_h | |
6 #define SensorReadingEvent_h | |
7 | |
8 #include "modules/EventModules.h" | |
9 #include "modules/sensor/SensorReading.h" | |
10 #include "modules/sensor/SensorReadingEventInit.h" | |
11 #include "platform/heap/Handle.h" | |
12 | |
13 namespace blink { | |
14 | |
15 class SensorReadingEvent : public Event { | |
16 DEFINE_WRAPPERTYPEINFO(); | |
17 | |
18 public: | |
19 static SensorReadingEvent* create(const AtomicString& eventType, | |
20 SensorReading* reading) { | |
21 return new SensorReadingEvent(eventType, reading); | |
22 } | |
23 | |
24 static SensorReadingEvent* create(const AtomicString& eventType, | |
25 const SensorReadingEventInit& initializer) { | |
26 return new SensorReadingEvent(eventType, initializer); | |
27 } | |
28 | |
29 ~SensorReadingEvent() override; | |
30 | |
31 const SensorReading* reading() const { return m_reading.get(); } | |
32 SensorReading* reading() { return m_reading.get(); } | |
33 const AtomicString& interfaceName() const override; | |
34 | |
35 DECLARE_VIRTUAL_TRACE(); | |
36 | |
37 protected: | |
38 Member<SensorReading> m_reading; | |
39 | |
40 private: | |
41 SensorReadingEvent(const AtomicString& eventType, SensorReading*); | |
42 SensorReadingEvent(const AtomicString& eventType, | |
43 const SensorReadingEventInit& initializer); | |
44 }; | |
45 | |
46 DEFINE_TYPE_CASTS(SensorReadingEvent, | |
47 Event, | |
48 event, | |
49 event->interfaceName() == EventNames::SensorReadingEvent, | |
50 event.interfaceName() == EventNames::SensorReadingEvent); | |
51 | |
52 } // namepsace blink | |
53 | |
54 #endif // SensorReadingEvent_h | |
OLD | NEW |