| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 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 SensorReading* createSensorReading(SensorProxy*) = 0; | 69 virtual SensorReading* createSensorReading(SensorProxy*) = 0; |
| 70 | 70 |
| 71 using SensorConfigurationPtr = device::mojom::blink::SensorConfigurationPtr; | 71 using SensorConfigurationPtr = device::mojom::blink::SensorConfigurationPtr; |
| 72 using SensorConfiguration = device::mojom::blink::SensorConfiguration; | 72 using SensorConfiguration = device::mojom::blink::SensorConfiguration; |
| 73 virtual SensorConfigurationPtr createSensorConfig( | 73 |
| 74 const SensorOptions&, | 74 // The default implementation will init frequency configuration parameter, |
| 75 const SensorConfiguration& defaultConfiguration) = 0; | 75 // concrete sensor implementations can override this method to handle other |
| 76 // parameters if needed. |
| 77 virtual SensorConfigurationPtr createSensorConfig(); |
| 76 | 78 |
| 77 private: | 79 private: |
| 78 void initSensorProxyIfNeeded(); | 80 void initSensorProxyIfNeeded(); |
| 79 | 81 |
| 80 // ContextLifecycleObserver overrides. | 82 // ContextLifecycleObserver overrides. |
| 81 void contextDestroyed() override; | 83 void contextDestroyed() override; |
| 82 | 84 |
| 83 // SensorController::Observer overrides. | 85 // SensorController::Observer overrides. |
| 84 void onSensorInitialized() override; | 86 void onSensorInitialized() override; |
| 85 void onSensorReadingChanged() override; | 87 void onSensorReadingChanged() override; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 SensorProxy::Reading m_storedData; | 122 SensorProxy::Reading 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 |