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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "device/generic_sensor/platform_sensor_provider_mac.h"
6
7 #include "base/memory/singleton.h"
8 #include "device/generic_sensor/platform_sensor_ambient_light_mac.h"
9
10 namespace device {
11
12 // static
13 PlatformSensorProvider* PlatformSensorProvider::GetInstance() {
14 return PlatformSensorProviderMac::GetInstance();
15 }
16
17 // static
18 PlatformSensorProviderMac* PlatformSensorProviderMac::GetInstance() {
19 return base::Singleton<
20 PlatformSensorProviderMac,
21 base::LeakySingletonTraits<PlatformSensorProviderMac>>::get();
22 }
23
24 PlatformSensorProviderMac::PlatformSensorProviderMac() = default;
25
26 PlatformSensorProviderMac::~PlatformSensorProviderMac() = default;
27
28 void PlatformSensorProviderMac::CreateSensorInternal(
29 mojom::SensorType type,
30 mojo::ScopedSharedBufferMapping mapping,
31 const CreateSensorCallback& callback) {
32 // Create Sensors here.
33 switch (type) {
34 case mojom::SensorType::AMBIENT_LIGHT: {
35 scoped_refptr<PlatformSensor> sensor =
36 new PlatformSensorAmbientLightMac(type, std::move(mapping), this);
37 callback.Run(std::move(sensor));
38 break;
39 }
40 default:
41 NOTIMPLEMENTED();
42 callback.Run(nullptr);
43 }
44 }
45
46 } // namespace device
OLDNEW
« 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