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