| 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 SERVICES_DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ |
| 6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ | 6 #define SERVICES_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 "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
| 16 #include "device/generic_sensor/generic_sensor_export.h" | |
| 17 #include "device/generic_sensor/public/cpp/sensor_reading.h" | |
| 18 #include "device/generic_sensor/public/interfaces/sensor.mojom.h" | |
| 19 #include "mojo/public/cpp/system/buffer.h" | 16 #include "mojo/public/cpp/system/buffer.h" |
| 17 #include "services/device/public/cpp/generic_sensor/sensor_reading.h" |
| 18 #include "services/device/public/interfaces/sensor.mojom.h" |
| 20 | 19 |
| 21 namespace device { | 20 namespace device { |
| 22 | 21 |
| 23 class PlatformSensorProvider; | 22 class PlatformSensorProvider; |
| 24 class PlatformSensorConfiguration; | 23 class PlatformSensorConfiguration; |
| 25 | 24 |
| 26 // 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 |
| 27 // this class are created by platform specific PlatformSensorProvider. | 26 // this class are created by platform specific PlatformSensorProvider. |
| 28 class DEVICE_GENERIC_SENSOR_EXPORT PlatformSensor | 27 class PlatformSensor : public base::RefCountedThreadSafe<PlatformSensor> { |
| 29 : public base::RefCountedThreadSafe<PlatformSensor> { | |
| 30 public: | 28 public: |
| 31 // The interface that must be implemented by PlatformSensor clients. | 29 // The interface that must be implemented by PlatformSensor clients. |
| 32 class Client { | 30 class Client { |
| 33 public: | 31 public: |
| 34 virtual void OnSensorReadingChanged() = 0; | 32 virtual void OnSensorReadingChanged() = 0; |
| 35 virtual void OnSensorError() = 0; | 33 virtual void OnSensorError() = 0; |
| 36 virtual bool IsNotificationSuspended() = 0; | 34 virtual bool IsNotificationSuspended() = 0; |
| 37 | 35 |
| 38 protected: | 36 protected: |
| 39 virtual ~Client() {} | 37 virtual ~Client() {} |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 mojom::SensorType type_; | 99 mojom::SensorType type_; |
| 102 base::ObserverList<Client, true> clients_; | 100 base::ObserverList<Client, true> clients_; |
| 103 ConfigMap config_map_; | 101 ConfigMap config_map_; |
| 104 PlatformSensorProvider* provider_; | 102 PlatformSensorProvider* provider_; |
| 105 base::WeakPtrFactory<PlatformSensor> weak_factory_; | 103 base::WeakPtrFactory<PlatformSensor> weak_factory_; |
| 106 DISALLOW_COPY_AND_ASSIGN(PlatformSensor); | 104 DISALLOW_COPY_AND_ASSIGN(PlatformSensor); |
| 107 }; | 105 }; |
| 108 | 106 |
| 109 } // namespace device | 107 } // namespace device |
| 110 | 108 |
| 111 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ | 109 #endif // SERVICES_DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ |
| OLD | NEW |