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 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 void RemoveClient(Client*); | 49 void RemoveClient(Client*); |
50 | 50 |
51 protected: | 51 protected: |
52 virtual ~PlatformSensor(); | 52 virtual ~PlatformSensor(); |
53 PlatformSensor(mojom::SensorType type, | 53 PlatformSensor(mojom::SensorType type, |
54 mojo::ScopedSharedBufferMapping mapping, | 54 mojo::ScopedSharedBufferMapping mapping, |
55 PlatformSensorProvider* provider); | 55 PlatformSensorProvider* provider); |
56 | 56 |
57 using ConfigMap = std::map<Client*, std::list<PlatformSensorConfiguration>>; | 57 using ConfigMap = std::map<Client*, std::list<PlatformSensorConfiguration>>; |
58 | 58 |
59 virtual bool UpdateSensorInternal(const ConfigMap& configurations) = 0; | 59 virtual bool UpdateSensorInternal(const ConfigMap& configurations); |
| 60 virtual bool StartSensor( |
| 61 const PlatformSensorConfiguration& configuration) = 0; |
| 62 virtual void StopSensor() = 0; |
60 virtual bool CheckSensorConfiguration( | 63 virtual bool CheckSensorConfiguration( |
61 const PlatformSensorConfiguration& configuration) = 0; | 64 const PlatformSensorConfiguration& configuration) = 0; |
62 | 65 |
63 void NotifySensorReadingChanged(); | 66 void NotifySensorReadingChanged(); |
64 void NotifySensorError(); | 67 void NotifySensorError(); |
65 | 68 |
66 mojo::ScopedSharedBufferMapping shared_buffer_mapping_; | 69 mojo::ScopedSharedBufferMapping shared_buffer_mapping_; |
67 | 70 |
68 private: | 71 private: |
69 friend class base::RefCountedThreadSafe<PlatformSensor>; | 72 friend class base::RefCountedThreadSafe<PlatformSensor>; |
70 | 73 |
71 mojom::SensorType type_; | 74 mojom::SensorType type_; |
72 base::ObserverList<Client, true> clients_; | 75 base::ObserverList<Client, true> clients_; |
73 ConfigMap config_map_; | 76 ConfigMap config_map_; |
74 PlatformSensorProvider* provider_; | 77 PlatformSensorProvider* provider_; |
75 base::WeakPtrFactory<PlatformSensor> weak_factory_; | 78 base::WeakPtrFactory<PlatformSensor> weak_factory_; |
76 DISALLOW_COPY_AND_ASSIGN(PlatformSensor); | 79 DISALLOW_COPY_AND_ASSIGN(PlatformSensor); |
77 }; | 80 }; |
78 | 81 |
79 } // namespace device | 82 } // namespace device |
80 | 83 |
81 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ | 84 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_H_ |
OLD | NEW |