| 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 SensorProxy_h | 5 #ifndef SensorProxy_h |
| 6 #define SensorProxy_h | 6 #define SensorProxy_h |
| 7 | 7 |
| 8 #include "core/dom/ExceptionCode.h" | 8 #include "core/dom/ExceptionCode.h" |
| 9 #include "core/page/PageVisibilityObserver.h" | 9 #include "core/page/PageVisibilityObserver.h" |
| 10 #include "device/generic_sensor/public/cpp/sensor_reading.h" | 10 #include "device/generic_sensor/public/cpp/sensor_reading.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void notifySensorChanged(double timestamp); | 101 void notifySensorChanged(double timestamp); |
| 102 | 102 |
| 103 // device::mojom::blink::SensorClient overrides. | 103 // device::mojom::blink::SensorClient overrides. |
| 104 void RaiseError() override; | 104 void RaiseError() override; |
| 105 void SensorReadingChanged() override; | 105 void SensorReadingChanged() override; |
| 106 | 106 |
| 107 // PageVisibilityObserver overrides. | 107 // PageVisibilityObserver overrides. |
| 108 void pageVisibilityChanged() override; | 108 void pageVisibilityChanged() override; |
| 109 | 109 |
| 110 // Generic handler for a fatal error. | 110 // Generic handler for a fatal error. |
| 111 // String parameters are intentionally copied. | 111 void handleSensorError(); |
| 112 void handleSensorError(ExceptionCode = UnknownError, | 112 |
| 113 String sanitizedMessage = String(), | |
| 114 String unsanitizedMessage = String()); | |
| 115 // mojo call callbacks. | 113 // mojo call callbacks. |
| 116 void onSensorCreated(device::mojom::blink::SensorInitParamsPtr, | 114 void onSensorCreated(device::mojom::blink::SensorInitParamsPtr, |
| 117 device::mojom::blink::SensorClientRequest); | 115 device::mojom::blink::SensorClientRequest); |
| 118 void onAddConfigurationCompleted( | 116 void onAddConfigurationCompleted( |
| 119 double frequency, | 117 double frequency, |
| 120 std::unique_ptr<Function<void(bool)>> callback, | 118 std::unique_ptr<Function<void(bool)>> callback, |
| 121 bool result); | 119 bool result); |
| 122 void onRemoveConfigurationCompleted(double frequency, bool result); | 120 void onRemoveConfigurationCompleted(double frequency, bool result); |
| 123 | 121 |
| 124 bool tryReadFromBuffer(device::SensorReading& result); | 122 bool tryReadFromBuffer(device::SensorReading& result); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 149 using ReadingBuffer = device::SensorReadingSharedBuffer; | 147 using ReadingBuffer = device::SensorReadingSharedBuffer; |
| 150 static_assert( | 148 static_assert( |
| 151 sizeof(ReadingBuffer) == | 149 sizeof(ReadingBuffer) == |
| 152 device::mojom::blink::SensorInitParams::kReadBufferSizeForTests, | 150 device::mojom::blink::SensorInitParams::kReadBufferSizeForTests, |
| 153 "Check reading buffer size for tests"); | 151 "Check reading buffer size for tests"); |
| 154 }; | 152 }; |
| 155 | 153 |
| 156 } // namespace blink | 154 } // namespace blink |
| 157 | 155 |
| 158 #endif // SensorProxy_h | 156 #endif // SensorProxy_h |
| OLD | NEW |