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

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

Issue 2480773002: Reland of [sensors] Ambient light sensor implementation for ChromeOS and Linux. (Closed)
Patch Set: remove parenthesis Created 4 years, 1 month 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
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.h" 5 #include "device/generic_sensor/platform_sensor_provider.h"
6 6
7 #if defined(OS_MACOSX) 7 #if defined(OS_MACOSX)
8 #include "device/generic_sensor/platform_sensor_provider_mac.h" 8 #include "device/generic_sensor/platform_sensor_provider_mac.h"
9 #elif defined(OS_ANDROID) 9 #elif defined(OS_ANDROID)
10 #include "device/generic_sensor/platform_sensor_provider_android.h" 10 #include "device/generic_sensor/platform_sensor_provider_android.h"
11 #elif defined(OS_WIN) 11 #elif defined(OS_WIN)
12 #include "device/generic_sensor/platform_sensor_provider_win.h" 12 #include "device/generic_sensor/platform_sensor_provider_win.h"
13 #elif defined(OS_LINUX)
14 #include "device/generic_sensor/platform_sensor_provider_linux.h"
13 #endif 15 #endif
14 16
15 namespace { 17 namespace {
16 18
17 static device::PlatformSensorProvider* g_provider_for_testing = nullptr; 19 static device::PlatformSensorProvider* g_provider_for_testing = nullptr;
18 20
19 } // namespace 21 } // namespace
20 22
21 namespace device { 23 namespace device {
22 24
23 // static 25 // static
24 void PlatformSensorProvider::SetProviderForTesting( 26 void PlatformSensorProvider::SetProviderForTesting(
25 PlatformSensorProvider* provider) { 27 PlatformSensorProvider* provider) {
26 g_provider_for_testing = provider; 28 g_provider_for_testing = provider;
27 } 29 }
28 30
29 // static 31 // static
30 PlatformSensorProvider* PlatformSensorProvider::GetInstance() { 32 PlatformSensorProvider* PlatformSensorProvider::GetInstance() {
31 if (g_provider_for_testing) 33 if (g_provider_for_testing)
32 return g_provider_for_testing; 34 return g_provider_for_testing;
33 #if defined(OS_MACOSX) 35 #if defined(OS_MACOSX)
34 return PlatformSensorProviderMac::GetInstance(); 36 return PlatformSensorProviderMac::GetInstance();
35 #elif defined(OS_ANDROID) 37 #elif defined(OS_ANDROID)
36 return PlatformSensorProviderAndroid::GetInstance(); 38 return PlatformSensorProviderAndroid::GetInstance();
37 #elif defined(OS_WIN) 39 #elif defined(OS_WIN)
38 return PlatformSensorProviderWin::GetInstance(); 40 return PlatformSensorProviderWin::GetInstance();
39 #else 41 #elif defined(OS_LINUX)
40 return nullptr; 42 return PlatformSensorProviderLinux::GetInstance();
41 #endif 43 #endif
42 } 44 }
43 45
44 } // namespace device 46 } // namespace device
OLDNEW
« no previous file with comments | « device/generic_sensor/platform_sensor_linux.cc ('k') | device/generic_sensor/platform_sensor_provider_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698