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 DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ | 5 #ifndef DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ |
6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ | 6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 15 #include "device/generic_sensor/generic_sensor_export.h" |
15 #include "device/generic_sensor/public/cpp/sensor_reading.h" | 16 #include "device/generic_sensor/public/cpp/sensor_reading.h" |
16 #include "device/generic_sensor/public/interfaces/sensor.mojom.h" | 17 #include "device/generic_sensor/public/interfaces/sensor.mojom.h" |
17 #include "mojo/public/cpp/system/buffer.h" | 18 #include "mojo/public/cpp/system/buffer.h" |
18 | 19 |
19 namespace device { | 20 namespace device { |
20 | 21 |
21 class PlatformSensorProvider; | 22 class PlatformSensorProvider; |
22 class PlatformSensorConfiguration; | 23 class PlatformSensorConfiguration; |
23 | 24 |
24 // Base class for the sensors provided by the platform. Concrete instances of | 25 // Base class for the sensors provided by the platform. Concrete instances of |
25 // this class are created by platform specific PlatformSensorProvider. | 26 // this class are created by platform specific PlatformSensorProvider. |
26 class PlatformSensor : public base::RefCountedThreadSafe<PlatformSensor> { | 27 class DEVICE_GENERIC_SENSOR_EXPORT PlatformSensor |
| 28 : public base::RefCountedThreadSafe<PlatformSensor> { |
27 public: | 29 public: |
28 // The interface that must be implemented by PlatformSensor clients. | 30 // The interface that must be implemented by PlatformSensor clients. |
29 class Client { | 31 class Client { |
30 public: | 32 public: |
31 virtual void OnSensorReadingChanged() = 0; | 33 virtual void OnSensorReadingChanged() = 0; |
32 virtual void OnSensorError() = 0; | 34 virtual void OnSensorError() = 0; |
33 virtual bool IsNotificationSuspended() = 0; | 35 virtual bool IsNotificationSuspended() = 0; |
34 | 36 |
35 protected: | 37 protected: |
36 virtual ~Client() {} | 38 virtual ~Client() {} |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 base::ObserverList<Client, true> clients_; | 90 base::ObserverList<Client, true> clients_; |
89 ConfigMap config_map_; | 91 ConfigMap config_map_; |
90 PlatformSensorProvider* provider_; | 92 PlatformSensorProvider* provider_; |
91 base::WeakPtrFactory<PlatformSensor> weak_factory_; | 93 base::WeakPtrFactory<PlatformSensor> weak_factory_; |
92 DISALLOW_COPY_AND_ASSIGN(PlatformSensor); | 94 DISALLOW_COPY_AND_ASSIGN(PlatformSensor); |
93 }; | 95 }; |
94 | 96 |
95 } // namespace device | 97 } // namespace device |
96 | 98 |
97 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ | 99 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ |
OLD | NEW |