| 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 "core/dom/ContextLifecycleObserver.h" | 8 #include "core/dom/ContextLifecycleObserver.h" |
| 9 #include "core/dom/DOMHighResTimeStamp.h" | 9 #include "core/dom/DOMHighResTimeStamp.h" |
| 10 #include "core/dom/DOMTimeStamp.h" | 10 #include "core/dom/DOMTimeStamp.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 // parameters if needed. | 74 // parameters if needed. |
| 75 virtual SensorConfigurationPtr CreateSensorConfig(); | 75 virtual SensorConfigurationPtr CreateSensorConfig(); |
| 76 | 76 |
| 77 double ReadingValue(int index, bool& is_null) const; | 77 double ReadingValue(int index, bool& is_null) const; |
| 78 double ReadingValueUnchecked(int index) const; | 78 double ReadingValueUnchecked(int index) const; |
| 79 bool CanReturnReadings() const; | 79 bool CanReturnReadings() const; |
| 80 bool IsActivated() const { return state_ == SensorState::kActivated; } | 80 bool IsActivated() const { return state_ == SensorState::kActivated; } |
| 81 | 81 |
| 82 // SensorProxy::Observer overrides. | 82 // SensorProxy::Observer overrides. |
| 83 void OnSensorInitialized() override; | 83 void OnSensorInitialized() override; |
| 84 void OnSensorReadingChanged(double timestamp) override; | 84 void OnSensorReadingChanged() override; |
| 85 void OnSensorError(ExceptionCode, | 85 void OnSensorError(ExceptionCode, |
| 86 const String& sanitized_message, | 86 const String& sanitized_message, |
| 87 const String& unsanitized_message) override; | 87 const String& unsanitized_message) override; |
| 88 | 88 |
| 89 private: | 89 private: |
| 90 void InitSensorProxyIfNeeded(); | 90 void InitSensorProxyIfNeeded(); |
| 91 | 91 |
| 92 // ContextLifecycleObserver overrides. | 92 // ContextLifecycleObserver overrides. |
| 93 void ContextDestroyed(ExecutionContext*) override; | 93 void ContextDestroyed(ExecutionContext*) override; |
| 94 | 94 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 108 void NotifyOnActivate(); | 108 void NotifyOnActivate(); |
| 109 void NotifyError(DOMException* error); | 109 void NotifyError(DOMException* error); |
| 110 | 110 |
| 111 private: | 111 private: |
| 112 SensorOptions sensor_options_; | 112 SensorOptions sensor_options_; |
| 113 device::mojom::blink::SensorType type_; | 113 device::mojom::blink::SensorType type_; |
| 114 SensorState state_; | 114 SensorState state_; |
| 115 Member<SensorProxy> sensor_proxy_; | 115 Member<SensorProxy> sensor_proxy_; |
| 116 device::SensorReading reading_; | 116 device::SensorReading reading_; |
| 117 SensorConfigurationPtr configuration_; | 117 SensorConfigurationPtr configuration_; |
| 118 double last_update_timestamp_; | |
| 119 bool pending_reading_update_; | 118 bool pending_reading_update_; |
| 120 }; | 119 }; |
| 121 | 120 |
| 122 } // namespace blink | 121 } // namespace blink |
| 123 | 122 |
| 124 #endif // Sensor_h | 123 #endif // Sensor_h |
| OLD | NEW |