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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 private: | 77 private: |
78 void initSensorProxyIfNeeded(); | 78 void initSensorProxyIfNeeded(); |
79 | 79 |
80 // ContextLifecycleObserver overrides. | 80 // ContextLifecycleObserver overrides. |
81 void contextDestroyed() override; | 81 void contextDestroyed() override; |
82 | 82 |
83 // SensorController::Observer overrides. | 83 // SensorController::Observer overrides. |
84 void onSensorInitialized() override; | 84 void onSensorInitialized() override; |
85 void onSensorReadingChanged() override; | 85 void onSensorReadingChanged() override; |
86 void onSensorError() override; | 86 void onSensorError(ExceptionCode, |
| 87 const String& sanitizedMessage, |
| 88 const String& unsanitizedMessage) override; |
87 | 89 |
88 void onStartRequestCompleted(bool); | 90 void onStartRequestCompleted(bool); |
89 void onStopRequestCompleted(bool); | 91 void onStopRequestCompleted(bool); |
90 | 92 |
91 // PageVisibilityObserver overrides. | 93 // PageVisibilityObserver overrides. |
92 void pageVisibilityChanged() override; | 94 void pageVisibilityChanged() override; |
93 | 95 |
94 void startListening(); | 96 void startListening(); |
95 void stopListening(); | 97 void stopListening(); |
96 | 98 |
97 // Makes sensor reading refresh its values from the shared buffer. | 99 // Makes sensor reading refresh its values from the shared buffer. |
98 void pollForData(); | 100 void pollForData(); |
99 | 101 |
100 void updateState(SensorState newState); | 102 void updateState(SensorState newState); |
101 void reportError(); | 103 void reportError(ExceptionCode = UnknownError, |
| 104 const String& sanitizedMessage = String(), |
| 105 const String& unsanitizedMessage = String()); |
102 | 106 |
103 void updatePollingStatus(); | 107 void updatePollingStatus(); |
104 | 108 |
105 void notifySensorReadingChanged(); | 109 void notifySensorReadingChanged(); |
106 void notifyStateChanged(); | 110 void notifyStateChanged(); |
| 111 void notifyError(DOMException* error); |
107 | 112 |
108 private: | 113 private: |
109 Member<SensorReading> m_sensorReading; | 114 Member<SensorReading> m_sensorReading; |
110 SensorOptions m_sensorOptions; | 115 SensorOptions m_sensorOptions; |
111 device::mojom::blink::SensorType m_type; | 116 device::mojom::blink::SensorType m_type; |
112 SensorState m_state; | 117 SensorState m_state; |
113 Member<SensorProxy> m_sensorProxy; | 118 Member<SensorProxy> m_sensorProxy; |
114 std::unique_ptr<SensorPollingStrategy> m_polling; | 119 std::unique_ptr<SensorPollingStrategy> m_polling; |
115 SensorProxy::Reading m_storedData; | 120 SensorProxy::Reading m_storedData; |
116 SensorConfigurationPtr m_configuration; | 121 SensorConfigurationPtr m_configuration; |
117 }; | 122 }; |
118 | 123 |
119 } // namespace blink | 124 } // namespace blink |
120 | 125 |
121 #endif // Sensor_h | 126 #endif // Sensor_h |
OLD | NEW |