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 Accelerometer_h | 5 #ifndef Accelerometer_h |
6 #define Accelerometer_h | 6 #define Accelerometer_h |
7 | 7 |
8 #include "modules/sensor/AccelerometerOptions.h" | 8 #include "modules/sensor/AccelerometerOptions.h" |
9 #include "modules/sensor/Sensor.h" | 9 #include "modules/sensor/Sensor.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class AccelerometerReading; | |
14 | |
15 class Accelerometer final : public Sensor { | 13 class Accelerometer final : public Sensor { |
16 DEFINE_WRAPPERTYPEINFO(); | 14 DEFINE_WRAPPERTYPEINFO(); |
17 | 15 |
18 public: | 16 public: |
19 static Accelerometer* create(ExecutionContext*, | 17 static Accelerometer* create(ExecutionContext*, |
20 const AccelerometerOptions&, | 18 const AccelerometerOptions&, |
21 ExceptionState&); | 19 ExceptionState&); |
22 static Accelerometer* create(ExecutionContext*, ExceptionState&); | 20 static Accelerometer* create(ExecutionContext*, ExceptionState&); |
23 | 21 |
24 AccelerometerReading* reading() const; | 22 double x(bool& isNull) const; |
| 23 double y(bool& isNull) const; |
| 24 double z(bool& isNull) const; |
25 bool includesGravity() const; | 25 bool includesGravity() const; |
26 | 26 |
27 DECLARE_VIRTUAL_TRACE(); | 27 DECLARE_VIRTUAL_TRACE(); |
28 | 28 |
29 private: | 29 private: |
30 Accelerometer(ExecutionContext*, | 30 Accelerometer(ExecutionContext*, |
31 const AccelerometerOptions&, | 31 const AccelerometerOptions&, |
32 ExceptionState&); | 32 ExceptionState&); |
33 // Sensor overrides. | 33 // Sensor overrides. |
34 std::unique_ptr<SensorReadingFactory> createSensorReadingFactory() override; | |
35 AccelerometerOptions m_accelerometerOptions; | 34 AccelerometerOptions m_accelerometerOptions; |
36 }; | 35 }; |
37 | 36 |
38 } // namespace blink | 37 } // namespace blink |
39 | 38 |
40 #endif // Accelerometer_h | 39 #endif // Accelerometer_h |
OLD | NEW |