| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 return ContextLifecycleObserver::getExecutionContext(); | 47 return ContextLifecycleObserver::getExecutionContext(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 // Getters | 50 // Getters |
| 51 String state() const; | 51 String state() const; |
| 52 // TODO(riju): crbug.com/614797 . | 52 // TODO(riju): crbug.com/614797 . |
| 53 SensorReading* reading() const; | 53 SensorReading* reading() const; |
| 54 | 54 |
| 55 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | 55 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
| 56 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); | 56 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); |
| 57 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); | 57 DEFINE_ATTRIBUTE_EVENT_LISTENER(activate); |
| 58 | 58 |
| 59 // ActiveScriptWrappable overrides. | 59 // ActiveScriptWrappable overrides. |
| 60 bool hasPendingActivity() const override; | 60 bool hasPendingActivity() const override; |
| 61 | 61 |
| 62 DECLARE_VIRTUAL_TRACE(); | 62 DECLARE_VIRTUAL_TRACE(); |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 Sensor(ScriptState*, | 65 Sensor(ScriptState*, |
| 66 const SensorOptions&, | 66 const SensorOptions&, |
| 67 ExceptionState&, | 67 ExceptionState&, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void pollForData(); | 101 void pollForData(); |
| 102 | 102 |
| 103 void updateState(SensorState newState); | 103 void updateState(SensorState newState); |
| 104 void reportError(ExceptionCode = UnknownError, | 104 void reportError(ExceptionCode = UnknownError, |
| 105 const String& sanitizedMessage = String(), | 105 const String& sanitizedMessage = String(), |
| 106 const String& unsanitizedMessage = String()); | 106 const String& unsanitizedMessage = String()); |
| 107 | 107 |
| 108 void updatePollingStatus(); | 108 void updatePollingStatus(); |
| 109 | 109 |
| 110 void notifySensorReadingChanged(); | 110 void notifySensorReadingChanged(); |
| 111 void notifyStateChanged(); | 111 void notifyOnActivate(); |
| 112 void notifyError(DOMException* error); | 112 void notifyError(DOMException* error); |
| 113 | 113 |
| 114 private: | 114 private: |
| 115 SensorOptions m_sensorOptions; | 115 SensorOptions m_sensorOptions; |
| 116 device::mojom::blink::SensorType m_type; | 116 device::mojom::blink::SensorType m_type; |
| 117 SensorState m_state; | 117 SensorState m_state; |
| 118 Member<SensorProxy> m_sensorProxy; | 118 Member<SensorProxy> m_sensorProxy; |
| 119 std::unique_ptr<SensorPollingStrategy> m_polling; | 119 std::unique_ptr<SensorPollingStrategy> m_polling; |
| 120 device::SensorReading m_storedData; | 120 device::SensorReading m_storedData; |
| 121 SensorConfigurationPtr m_configuration; | 121 SensorConfigurationPtr m_configuration; |
| 122 }; | 122 }; |
| 123 | 123 |
| 124 } // namespace blink | 124 } // namespace blink |
| 125 | 125 |
| 126 #endif // Sensor_h | 126 #endif // Sensor_h |
| OLD | NEW |