OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_BROWSER_DEVICE_SENSORS_AMBIENT_LIGHT_MAC_H_ | 5 #ifndef CONTENT_BROWSER_DEVICE_SENSORS_AMBIENT_LIGHT_MAC_H_ |
6 #define CONTENT_BROWSER_DEVICE_SENSORS_AMBIENT_LIGHT_MAC_H_ | 6 #define CONTENT_BROWSER_DEVICE_SENSORS_AMBIENT_LIGHT_MAC_H_ |
7 | 7 |
8 #include <IOKit/IOKitLib.h> | 8 #include <IOKit/IOKitLib.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
| 11 #include <memory> |
| 12 |
11 #include "base/macros.h" | 13 #include "base/macros.h" |
12 #include "base/memory/scoped_ptr.h" | |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 | 16 |
16 // Provides an interface to retrieve ambient light data from MacBooks. | 17 // Provides an interface to retrieve ambient light data from MacBooks. |
17 class AmbientLightSensor { | 18 class AmbientLightSensor { |
18 public: | 19 public: |
19 // Create AmbientLightSensor object, return NULL if no valid is sensor found. | 20 // Create AmbientLightSensor object, return NULL if no valid is sensor found. |
20 static scoped_ptr<AmbientLightSensor> Create(); | 21 static std::unique_ptr<AmbientLightSensor> Create(); |
21 | 22 |
22 ~AmbientLightSensor(); | 23 ~AmbientLightSensor(); |
23 | 24 |
24 // Retrieve lux values from Ambient Light Sensor. | 25 // Retrieve lux values from Ambient Light Sensor. |
25 bool ReadSensorValue(uint64_t lux_value[2]); | 26 bool ReadSensorValue(uint64_t lux_value[2]); |
26 | 27 |
27 private: | 28 private: |
28 AmbientLightSensor(); | 29 AmbientLightSensor(); |
29 | 30 |
30 // Probe the local hardware looking for Ambient Light sensor and | 31 // Probe the local hardware looking for Ambient Light sensor and |
31 // initialize an I/O connection to it. | 32 // initialize an I/O connection to it. |
32 bool Init(); | 33 bool Init(); |
33 | 34 |
34 // IOKit connection to the local sensor. | 35 // IOKit connection to the local sensor. |
35 io_connect_t io_connection_; | 36 io_connect_t io_connection_; |
36 | 37 |
37 DISALLOW_COPY_AND_ASSIGN(AmbientLightSensor); | 38 DISALLOW_COPY_AND_ASSIGN(AmbientLightSensor); |
38 }; | 39 }; |
39 | 40 |
40 } // namespace content | 41 } // namespace content |
41 | 42 |
42 #endif // CONTENT_BROWSER_DEVICE_SENSORS_AMBIENT_LIGHT_MAC_H_ | 43 #endif // CONTENT_BROWSER_DEVICE_SENSORS_AMBIENT_LIGHT_MAC_H_ |
OLD | NEW |