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" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 protected: | 64 protected: |
65 Sensor(ScriptState*, | 65 Sensor(ScriptState*, |
66 const SensorOptions&, | 66 const SensorOptions&, |
67 ExceptionState&, | 67 ExceptionState&, |
68 device::mojom::blink::SensorType); | 68 device::mojom::blink::SensorType); |
69 virtual std::unique_ptr<SensorReadingFactory> | 69 virtual std::unique_ptr<SensorReadingFactory> |
70 createSensorReadingFactory() = 0; | 70 createSensorReadingFactory() = 0; |
71 | 71 |
72 using SensorConfigurationPtr = device::mojom::blink::SensorConfigurationPtr; | 72 using SensorConfigurationPtr = device::mojom::blink::SensorConfigurationPtr; |
73 using SensorConfiguration = device::mojom::blink::SensorConfiguration; | 73 using SensorConfiguration = device::mojom::blink::SensorConfiguration; |
74 virtual SensorConfigurationPtr createSensorConfig( | 74 |
75 const SensorOptions&, | 75 // The default implementation will init frequency configuration parameter, |
76 const SensorConfiguration& defaultConfiguration) = 0; | 76 // concrete sensor implementations can override this method to handle other |
| 77 // parameters if needed. |
| 78 virtual SensorConfigurationPtr createSensorConfig(); |
77 | 79 |
78 private: | 80 private: |
79 void initSensorProxyIfNeeded(); | 81 void initSensorProxyIfNeeded(); |
80 | 82 |
81 // ContextLifecycleObserver overrides. | 83 // ContextLifecycleObserver overrides. |
82 void contextDestroyed() override; | 84 void contextDestroyed() override; |
83 | 85 |
84 // SensorController::Observer overrides. | 86 // SensorController::Observer overrides. |
85 void onSensorInitialized() override; | 87 void onSensorInitialized() override; |
86 void onSensorReadingChanged() override; | 88 void onSensorReadingChanged() override; |
(...skipping 30 matching lines...) Expand all Loading... |
117 SensorState m_state; | 119 SensorState m_state; |
118 Member<SensorProxy> m_sensorProxy; | 120 Member<SensorProxy> m_sensorProxy; |
119 std::unique_ptr<SensorPollingStrategy> m_polling; | 121 std::unique_ptr<SensorPollingStrategy> m_polling; |
120 device::SensorReading m_storedData; | 122 device::SensorReading m_storedData; |
121 SensorConfigurationPtr m_configuration; | 123 SensorConfigurationPtr m_configuration; |
122 }; | 124 }; |
123 | 125 |
124 } // namespace blink | 126 } // namespace blink |
125 | 127 |
126 #endif // Sensor_h | 128 #endif // Sensor_h |
OLD | NEW |