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_PROVIDER_WIN_H_ | 5 #ifndef SERVICES_DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_PROVIDER_WIN_H_ |
6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_PROVIDER_WIN_H_ | 6 #define SERVICES_DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_PROVIDER_WIN_H_ |
7 | 7 |
8 #include <SensorsApi.h> | 8 #include <SensorsApi.h> |
9 | 9 |
10 #include "base/win/scoped_comptr.h" | 10 #include "base/win/scoped_comptr.h" |
11 #include "device/generic_sensor/generic_sensor_export.h" | 11 #include "services/device/generic_sensor/platform_sensor_provider.h" |
12 #include "device/generic_sensor/platform_sensor_provider.h" | |
13 | 12 |
14 namespace base { | 13 namespace base { |
15 template <typename T> | 14 template <typename T> |
16 struct DefaultSingletonTraits; | 15 struct DefaultSingletonTraits; |
17 class Thread; | 16 class Thread; |
18 } | 17 } |
19 | 18 |
20 namespace device { | 19 namespace device { |
21 | 20 |
22 class PlatformSensorReaderWin; | 21 class PlatformSensorReaderWin; |
23 | 22 |
24 // Implementation of PlatformSensorProvider for Windows platform. | 23 // Implementation of PlatformSensorProvider for Windows platform. |
25 // PlatformSensorProviderWin is responsible for following tasks: | 24 // PlatformSensorProviderWin is responsible for following tasks: |
26 // - Starts sensor thread and stops it when there are no active sensors. | 25 // - Starts sensor thread and stops it when there are no active sensors. |
27 // - Initialises ISensorManager and creates sensor reader on sensor thread. | 26 // - Initialises ISensorManager and creates sensor reader on sensor thread. |
28 // - Constructs PlatformSensorWin on IPC thread and returns it to requester. | 27 // - Constructs PlatformSensorWin on IPC thread and returns it to requester. |
29 class DEVICE_GENERIC_SENSOR_EXPORT PlatformSensorProviderWin final | 28 class PlatformSensorProviderWin final : public PlatformSensorProvider { |
30 : public PlatformSensorProvider { | |
31 public: | 29 public: |
32 static PlatformSensorProviderWin* GetInstance(); | 30 static PlatformSensorProviderWin* GetInstance(); |
33 | 31 |
34 // Overrides ISensorManager COM interface provided by the system, used | 32 // Overrides ISensorManager COM interface provided by the system, used |
35 // only for testing purposes. | 33 // only for testing purposes. |
36 void SetSensorManagerForTesting( | 34 void SetSensorManagerForTesting( |
37 base::win::ScopedComPtr<ISensorManager> sensor_manager); | 35 base::win::ScopedComPtr<ISensorManager> sensor_manager); |
38 | 36 |
39 protected: | 37 protected: |
40 ~PlatformSensorProviderWin() override; | 38 ~PlatformSensorProviderWin() override; |
(...skipping 22 matching lines...) Expand all Loading... |
63 friend struct base::DefaultSingletonTraits<PlatformSensorProviderWin>; | 61 friend struct base::DefaultSingletonTraits<PlatformSensorProviderWin>; |
64 | 62 |
65 base::win::ScopedComPtr<ISensorManager> sensor_manager_; | 63 base::win::ScopedComPtr<ISensorManager> sensor_manager_; |
66 std::unique_ptr<base::Thread> sensor_thread_; | 64 std::unique_ptr<base::Thread> sensor_thread_; |
67 | 65 |
68 DISALLOW_COPY_AND_ASSIGN(PlatformSensorProviderWin); | 66 DISALLOW_COPY_AND_ASSIGN(PlatformSensorProviderWin); |
69 }; | 67 }; |
70 | 68 |
71 } // namespace device | 69 } // namespace device |
72 | 70 |
73 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_PROVIDER_WIN_H_ | 71 #endif // SERVICES_DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_PROVIDER_WIN_H_ |
OLD | NEW |