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 SensorReadingEvent_h | 5 #ifndef SensorReadingEvent_h |
6 #define SensorReadingEvent_h | 6 #define SensorReadingEvent_h |
7 | 7 |
8 #include "modules/EventModules.h" | 8 #include "modules/EventModules.h" |
9 #include "modules/sensor/SensorReading.h" | 9 #include "modules/sensor/SensorReading.h" |
10 #include "modules/sensor/SensorReadingEventInit.h" | 10 #include "modules/sensor/SensorReadingEventInit.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 SensorReadingEvent : public Event { | 15 class SensorReadingEvent : public Event { |
16 DEFINE_WRAPPERTYPEINFO(); | 16 DEFINE_WRAPPERTYPEINFO(); |
17 | 17 |
18 public: | 18 public: |
19 static SensorReadingEvent* create() | |
20 { | |
21 return new SensorReadingEvent; | |
22 } | |
23 | |
24 static SensorReadingEvent* create(const AtomicString& eventType) | 19 static SensorReadingEvent* create(const AtomicString& eventType) |
25 { | 20 { |
26 return new SensorReadingEvent(eventType); | 21 return new SensorReadingEvent(eventType); |
27 } | 22 } |
28 | 23 |
29 static SensorReadingEvent* create(const AtomicString& eventType, SensorReadi
ng& reading) | 24 static SensorReadingEvent* create(const AtomicString& eventType, SensorReadi
ng& reading) |
30 { | 25 { |
31 return new SensorReadingEvent(eventType, reading); | 26 return new SensorReadingEvent(eventType, reading); |
32 } | 27 } |
33 | 28 |
34 static SensorReadingEvent* create(const AtomicString& eventType, const Senso
rReadingEventInit& initializer) | 29 static SensorReadingEvent* create(const AtomicString& eventType, const Senso
rReadingEventInit& initializer) |
35 { | 30 { |
36 return new SensorReadingEvent(eventType, initializer); | 31 return new SensorReadingEvent(eventType, initializer); |
37 } | 32 } |
38 | 33 |
39 ~SensorReadingEvent() override; | 34 ~SensorReadingEvent() override; |
40 | 35 |
41 // TODO(riju): crbug.com/614797 . | 36 // TODO(riju): crbug.com/614797 . |
42 SensorReading* reading() const { return m_reading.get(); } | 37 SensorReading* reading() const { return m_reading.get(); } |
43 const AtomicString& interfaceName() const override; | 38 const AtomicString& interfaceName() const override; |
44 | 39 |
45 DECLARE_VIRTUAL_TRACE(); | 40 DECLARE_VIRTUAL_TRACE(); |
46 | 41 |
47 protected: | 42 protected: |
48 Member<SensorReading> m_reading; | 43 Member<SensorReading> m_reading; |
49 | 44 |
50 private: | 45 private: |
51 SensorReadingEvent(); | |
52 explicit SensorReadingEvent(const AtomicString& eventType); | 46 explicit SensorReadingEvent(const AtomicString& eventType); |
53 SensorReadingEvent(const AtomicString& eventType, SensorReading&); | 47 SensorReadingEvent(const AtomicString& eventType, SensorReading&); |
54 SensorReadingEvent(const AtomicString& eventType, const SensorReadingEventIn
it& initializer); | 48 SensorReadingEvent(const AtomicString& eventType, const SensorReadingEventIn
it& initializer); |
55 | 49 |
56 }; | 50 }; |
57 | 51 |
58 DEFINE_TYPE_CASTS(SensorReadingEvent, Event, event, event->interfaceName() == Ev
entNames::SensorReadingEvent, event.interfaceName() == EventNames::SensorReading
Event); | 52 DEFINE_TYPE_CASTS(SensorReadingEvent, Event, event, event->interfaceName() == Ev
entNames::SensorReadingEvent, event.interfaceName() == EventNames::SensorReading
Event); |
59 | 53 |
60 } // namepsace blink | 54 } // namepsace blink |
61 | 55 |
62 #endif // SensorReadingEvent_h | 56 #endif // SensorReadingEvent_h |
OLD | NEW |