Chromium Code Reviews| Index: device/generic_sensor/platform_sensor_ambient_light_mac.h |
| diff --git a/device/generic_sensor/platform_sensor_ambient_light_mac.h b/device/generic_sensor/platform_sensor_ambient_light_mac.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..eebf81e2a400176b2c265b73a7a8984838d1d3b8 |
| --- /dev/null |
| +++ b/device/generic_sensor/platform_sensor_ambient_light_mac.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef DEVICE_GENERIC_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_MAC_H_ |
| +#define DEVICE_GENERIC_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_MAC_H_ |
| + |
| +#include <IOKit/IOKitLib.h> |
| + |
| +#include "base/mac/scoped_ioobject.h" |
| +#include "device/generic_sensor/platform_sensor.h" |
| + |
| +namespace base { |
| +class SingleThreadTaskRunner; |
| +} |
| + |
| +namespace device { |
| + |
| +class PlatformSensorAmbientLightMac : public PlatformSensor { |
| + public: |
| + PlatformSensorAmbientLightMac( |
| + mojom::SensorType type, |
| + mojo::ScopedSharedBufferMapping mapping, |
| + uint64_t buffer_size, |
| + PlatformSensorProvider* provider, |
| + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); |
|
Robert Sesek
2016/10/04 15:28:18
There's no reason to explicitly name this for the
|
| + |
| + mojom::ReportingMode GetReportingMode() override; |
| + bool StartSensor(const PlatformSensorConfiguration& configuration) override; |
| + void StopSensor() override; |
| + |
| + protected: |
| + ~PlatformSensorAmbientLightMac() override; |
| + bool CheckSensorConfiguration( |
| + const PlatformSensorConfiguration& configuration) override; |
| + PlatformSensorConfiguration GetDefaultConfiguration() override; |
| + void UpdateReading(uint64_t lux_values[2]); |
| + |
| + private: |
| + static void IOServiceCallback(void* context, |
| + io_service_t service, |
| + natural_t message_type, |
| + void*); |
| + base::mac::ScopedIOObject<io_service_t> light_sensor_service_; |
|
Reilly Grant (use Gerrit)
2016/10/04 07:11:27
nit: space between methods and fields
|
| + IONotificationPortRef light_sensor_port_; |
|
Reilly Grant (use Gerrit)
2016/10/04 07:11:27
Initialize this to nullptr.
|
| + io_object_t light_sensor_object_; |
| + scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| + double current_lux_; |
| + DISALLOW_COPY_AND_ASSIGN(PlatformSensorAmbientLightMac); |
|
Reilly Grant (use Gerrit)
2016/10/04 07:11:27
nit: space between fields and this macro
|
| +}; |
| + |
| +} // namespace device |
| + |
| +#endif // DEVICE_GENERIC_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_MAC_H_ |