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

Side by Side Diff: device/generic_sensor/platform_sensor_provider_mac.cc

Issue 2865263002: Move //device/generic_sensor to be part of the internal implementation of the Device Service. (Closed)
Patch Set: code rebase Created 3 years, 7 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_accelerometer_mac.h"
9 #include "device/generic_sensor/platform_sensor_ambient_light_mac.h"
10
11 namespace device {
12
13 // static
14 PlatformSensorProviderMac* PlatformSensorProviderMac::GetInstance() {
15 return base::Singleton<
16 PlatformSensorProviderMac,
17 base::LeakySingletonTraits<PlatformSensorProviderMac>>::get();
18 }
19
20 PlatformSensorProviderMac::PlatformSensorProviderMac() = default;
21
22 PlatformSensorProviderMac::~PlatformSensorProviderMac() = default;
23
24 void PlatformSensorProviderMac::CreateSensorInternal(
25 mojom::SensorType type,
26 mojo::ScopedSharedBufferMapping mapping,
27 const CreateSensorCallback& callback) {
28 // Create Sensors here.
29 switch (type) {
30 case mojom::SensorType::AMBIENT_LIGHT: {
31 scoped_refptr<PlatformSensor> sensor =
32 new PlatformSensorAmbientLightMac(std::move(mapping), this);
33 callback.Run(std::move(sensor));
34 break;
35 }
36 case mojom::SensorType::ACCELEROMETER: {
37 callback.Run(base::MakeRefCounted<PlatformSensorAccelerometerMac>(
38 std::move(mapping), this));
39 break;
40 }
41 default:
42 NOTIMPLEMENTED();
43 callback.Run(nullptr);
44 }
45 }
46
47 } // namespace device
OLDNEW
« no previous file with comments | « device/generic_sensor/platform_sensor_provider_mac.h ('k') | device/generic_sensor/platform_sensor_provider_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698