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