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

Unified Diff: device/generic_sensor/platform_sensor_ambient_light_mac.h

Issue 2332903002: [sensors] [mac] Implement ambient light sensor for macOS (Closed)
Patch Set: Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
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..5661f48e05b103e4efbdfdddf34f1a0b2df860cf
--- /dev/null
+++ b/device/generic_sensor/platform_sensor_ambient_light_mac.h
@@ -0,0 +1,48 @@
+// 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 "base/memory/ref_counted.h"
+#include "device/generic_sensor/platform_sensor_mac.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+}
+
+namespace content {
+class AmbientLightSensor;
+}
+
+namespace device {
+
+class PlatformSensorAmbientLightMac : public PlatformSensorMac {
+ public:
+ PlatformSensorAmbientLightMac(mojom::SensorType type,
+ mojo::ScopedSharedBufferMapping mapping,
+ uint64_t buffer_size,
+ PlatformSensorProvider* provider);
+
+ ~PlatformSensorAmbientLightMac() override;
+ mojom::ReportingMode GetReportingMode() override;
+ void UpdateReading() override;
+
+ protected:
+ virtual bool StartSensor(
+ const PlatformSensorConfiguration& configuration) override;
+ virtual void StopSensor() override;
+ bool CheckSensorConfiguration(
+ const PlatformSensorConfiguration& configuration) override;
+ PlatformSensorConfiguration GetDefaultConfiguration() override;
+
+ private:
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
+ std::unique_ptr<content::AmbientLightSensor> platformSensor_;
+ DISALLOW_COPY_AND_ASSIGN(PlatformSensorAmbientLightMac);
+};
+
+} // namespace device
+
+#endif // DEVICE_GENERIC_PLATFORM_SENSOR_AMBIENT_LIGHT_SENSOR_MAC_H_

Powered by Google App Engine
This is Rietveld 408576698