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

Unified Diff: device/generic_sensor/platform_sensor_mac.h

Issue 2332903002: [sensors] [mac] Implement ambient light sensor for macOS (Closed)
Patch Set: [sensors] [mac] Implement ambient light sensor for macOS 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_mac.h
diff --git a/device/generic_sensor/platform_sensor_mac.h b/device/generic_sensor/platform_sensor_mac.h
new file mode 100644
index 0000000000000000000000000000000000000000..c4fce5f926835533df451dbdc8cc9fc1b158995e
--- /dev/null
+++ b/device/generic_sensor/platform_sensor_mac.h
@@ -0,0 +1,44 @@
+// 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_SENSOR_PLATFORM_SENSOR_MAC_H_
+#define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_MAC_H_
+
+#include "base/timer/timer.h"
+#include "device/generic_sensor/platform_sensor.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+}
+
+namespace device {
+
+class PlatformSensorMac : public PlatformSensor {
+ public:
+ PlatformSensorMac(mojom::SensorType type,
+ mojo::ScopedSharedBufferMapping mapping,
+ PlatformSensorProvider* provider,
+ const scoped_refptr<base::SingleThreadTaskRunner>&
Mikhail 2016/09/16 16:23:54 pls pass scoped_refptr by value
+ polling_thread_task_runner);
+ virtual ~PlatformSensorMac();
Mikhail 2016/09/16 16:23:54 nit: override
+ bool StartSensor(const PlatformSensorConfiguration& configuration) override;
+ void StopSensor() override;
+
+ virtual void UpdateReading() = 0;
+
+ protected:
+ scoped_refptr<base::SingleThreadTaskRunner> polling_thread_task_runner_;
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
+ std::unique_ptr<base::RepeatingTimer> timer_;
+
+ private:
+ void BeginPoll(const PlatformSensorConfiguration& configuration);
+ void StopPoll();
+
+ DISALLOW_COPY_AND_ASSIGN(PlatformSensorMac);
+};
+
+} // namespace device
+
+#endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_MAC_H_

Powered by Google App Engine
This is Rietveld 408576698