Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(538)

Side by Side Diff: device/generic_sensor/platform_sensor.h

Issue 2431163004: [sensors] Make generic_sensor a component (Closed)
Patch Set: Win Clang Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « device/generic_sensor/generic_sensor_export.h ('k') | device/generic_sensor/platform_sensor_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698