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/ContextLifecycleObserver.h" | 10 #include "core/dom/ContextLifecycleObserver.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // ContextLifecycleObserver overrides. | 85 // ContextLifecycleObserver overrides. |
86 void ContextDestroyed(ExecutionContext*) override; | 86 void ContextDestroyed(ExecutionContext*) override; |
87 | 87 |
88 // SensorProxy::Observer overrides. | 88 // SensorProxy::Observer overrides. |
89 void OnSensorInitialized() override; | 89 void OnSensorInitialized() override; |
90 void NotifySensorChanged(double timestamp) override; | 90 void NotifySensorChanged(double timestamp) override; |
91 void OnSensorError(ExceptionCode, | 91 void OnSensorError(ExceptionCode, |
92 const String& sanitized_message, | 92 const String& sanitized_message, |
93 const String& unsanitized_message) override; | 93 const String& unsanitized_message) override; |
94 | 94 |
95 void OnStartRequestCompleted(bool); | 95 void OnAddConfigurationRequestCompleted(bool); |
96 void OnStopRequestCompleted(bool); | |
97 | 96 |
98 void StartListening(); | 97 void StartListening(); |
99 void StopListening(); | 98 void StopListening(); |
100 | 99 |
| 100 void RequestAddConfiguration(); |
| 101 |
101 void UpdateState(SensorState new_state); | 102 void UpdateState(SensorState new_state); |
102 void ReportError(ExceptionCode = kUnknownError, | 103 void HandleError(ExceptionCode = kUnknownError, |
103 const String& sanitized_message = String(), | 104 const String& sanitized_message = String(), |
104 const String& unsanitized_message = String()); | 105 const String& unsanitized_message = String()); |
105 | 106 |
106 void NotifySensorReadingChanged(); | 107 void NotifySensorReadingChanged(); |
107 void NotifyOnActivate(); | 108 void NotifyOnActivate(); |
108 void NotifyError(DOMException* error); | 109 void NotifyError(DOMException* error); |
109 | 110 |
110 private: | 111 private: |
111 SensorOptions sensor_options_; | 112 SensorOptions sensor_options_; |
112 device::mojom::blink::SensorType type_; | 113 device::mojom::blink::SensorType type_; |
113 SensorState state_; | 114 SensorState state_; |
114 Member<SensorProxy> sensor_proxy_; | 115 Member<SensorProxy> sensor_proxy_; |
115 device::SensorReading stored_data_; | 116 device::SensorReading stored_data_; |
116 SensorConfigurationPtr configuration_; | 117 SensorConfigurationPtr configuration_; |
117 double last_update_timestamp_; | 118 double last_update_timestamp_; |
118 }; | 119 }; |
119 | 120 |
120 } // namespace blink | 121 } // namespace blink |
121 | 122 |
122 #endif // Sensor_h | 123 #endif // Sensor_h |
OLD | NEW |