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

Unified Diff: device/generic_sensor/platform_sensor_provider_mac.cc

Issue 2332903002: [sensors] [mac] Implement ambient light sensor for macOS (Closed)
Patch Set: Update commit message Created 4 years, 2 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
« no previous file with comments | « device/generic_sensor/platform_sensor_provider_mac.h ('k') | device/sensors/public/cpp/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/generic_sensor/platform_sensor_provider_mac.cc
diff --git a/device/generic_sensor/platform_sensor_provider_mac.cc b/device/generic_sensor/platform_sensor_provider_mac.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e315074b3971c99f37401094d0192a494872f23e
--- /dev/null
+++ b/device/generic_sensor/platform_sensor_provider_mac.cc
@@ -0,0 +1,46 @@
+// 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.
+
+#include "device/generic_sensor/platform_sensor_provider_mac.h"
+
+#include "base/memory/singleton.h"
+#include "device/generic_sensor/platform_sensor_ambient_light_mac.h"
+
+namespace device {
+
+// static
+PlatformSensorProvider* PlatformSensorProvider::GetInstance() {
+ return PlatformSensorProviderMac::GetInstance();
+}
+
+// static
+PlatformSensorProviderMac* PlatformSensorProviderMac::GetInstance() {
+ return base::Singleton<
+ PlatformSensorProviderMac,
+ base::LeakySingletonTraits<PlatformSensorProviderMac>>::get();
+}
+
+PlatformSensorProviderMac::PlatformSensorProviderMac() = default;
+
+PlatformSensorProviderMac::~PlatformSensorProviderMac() = default;
+
+void PlatformSensorProviderMac::CreateSensorInternal(
+ mojom::SensorType type,
+ mojo::ScopedSharedBufferMapping mapping,
+ const CreateSensorCallback& callback) {
+ // Create Sensors here.
+ switch (type) {
+ case mojom::SensorType::AMBIENT_LIGHT: {
+ scoped_refptr<PlatformSensor> sensor =
+ new PlatformSensorAmbientLightMac(type, std::move(mapping), this);
+ callback.Run(std::move(sensor));
+ break;
+ }
+ default:
+ NOTIMPLEMENTED();
+ callback.Run(nullptr);
+ }
+}
+
+} // namespace device
« no previous file with comments | « device/generic_sensor/platform_sensor_provider_mac.h ('k') | device/sensors/public/cpp/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698