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