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 Sensor_h | 5 #ifndef Sensor_h |
6 #define Sensor_h | 6 #define Sensor_h |
7 | 7 |
8 #include "bindings/core/v8/ActiveScriptWrappable.h" | 8 #include "bindings/core/v8/ActiveScriptWrappable.h" |
9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "core/dom/ActiveDOMObject.h" | 10 #include "core/dom/ActiveDOMObject.h" |
11 #include "core/dom/ContextLifecycleObserver.h" | 11 #include "core/dom/ContextLifecycleObserver.h" |
12 #include "core/frame/PlatformEventController.h" | 12 #include "core/frame/PlatformEventController.h" |
13 #include "modules/EventTargetModules.h" | 13 #include "modules/EventTargetModules.h" |
14 #include "modules/sensor/SensorOptions.h" | 14 #include "modules/sensor/SensorOptions.h" |
15 #include "modules/sensor/SensorProxy.h" | 15 #include "modules/sensor/SensorProxy.h" |
16 #include "platform/heap/Handle.h" | 16 #include "platform/heap/Handle.h" |
17 | 17 |
18 namespace blink { | 18 namespace blink { |
19 | 19 |
20 class ExceptionState; | 20 class ExceptionState; |
21 class ScriptState; | 21 class ExecutionContext; |
22 class SensorReading; | 22 class SensorReading; |
23 class SensorUpdateNotificationStrategy; | 23 class SensorUpdateNotificationStrategy; |
24 | 24 |
25 class Sensor : public EventTargetWithInlineData, | 25 class Sensor : public EventTargetWithInlineData, |
26 public ActiveScriptWrappable, | 26 public ActiveScriptWrappable, |
27 public ContextLifecycleObserver, | 27 public ContextLifecycleObserver, |
28 public SensorProxy::Observer { | 28 public SensorProxy::Observer { |
29 USING_GARBAGE_COLLECTED_MIXIN(Sensor); | 29 USING_GARBAGE_COLLECTED_MIXIN(Sensor); |
30 DEFINE_WRAPPERTYPEINFO(); | 30 DEFINE_WRAPPERTYPEINFO(); |
31 | 31 |
(...skipping 21 matching lines...) Expand all Loading... |
53 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 53 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
54 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); | 54 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); |
55 DEFINE_ATTRIBUTE_EVENT_LISTENER(activate); | 55 DEFINE_ATTRIBUTE_EVENT_LISTENER(activate); |
56 | 56 |
57 // ActiveScriptWrappable overrides. | 57 // ActiveScriptWrappable overrides. |
58 bool hasPendingActivity() const override; | 58 bool hasPendingActivity() const override; |
59 | 59 |
60 DECLARE_VIRTUAL_TRACE(); | 60 DECLARE_VIRTUAL_TRACE(); |
61 | 61 |
62 protected: | 62 protected: |
63 Sensor(ScriptState*, | 63 Sensor(ExecutionContext*, |
64 const SensorOptions&, | 64 const SensorOptions&, |
65 ExceptionState&, | 65 ExceptionState&, |
66 device::mojom::blink::SensorType); | 66 device::mojom::blink::SensorType); |
67 virtual std::unique_ptr<SensorReadingFactory> | 67 virtual std::unique_ptr<SensorReadingFactory> |
68 createSensorReadingFactory() = 0; | 68 createSensorReadingFactory() = 0; |
69 | 69 |
70 using SensorConfigurationPtr = device::mojom::blink::SensorConfigurationPtr; | 70 using SensorConfigurationPtr = device::mojom::blink::SensorConfigurationPtr; |
71 using SensorConfiguration = device::mojom::blink::SensorConfiguration; | 71 using SensorConfiguration = device::mojom::blink::SensorConfiguration; |
72 | 72 |
73 // The default implementation will init frequency configuration parameter, | 73 // The default implementation will init frequency configuration parameter, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 SensorState m_state; | 112 SensorState m_state; |
113 Member<SensorProxy> m_sensorProxy; | 113 Member<SensorProxy> m_sensorProxy; |
114 std::unique_ptr<SensorUpdateNotificationStrategy> m_sensorUpdateNotifier; | 114 std::unique_ptr<SensorUpdateNotificationStrategy> m_sensorUpdateNotifier; |
115 device::SensorReading m_storedData; | 115 device::SensorReading m_storedData; |
116 SensorConfigurationPtr m_configuration; | 116 SensorConfigurationPtr m_configuration; |
117 }; | 117 }; |
118 | 118 |
119 } // namespace blink | 119 } // namespace blink |
120 | 120 |
121 #endif // Sensor_h | 121 #endif // Sensor_h |
OLD | NEW |