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

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

Issue 2859553003: Update PlatformSensorAmbientLightMac constructor (Closed)
Patch Set: update PlatformSensorAmbientLightMac constructor 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
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_ambient_light_mac.h" 5 #include "device/generic_sensor/platform_sensor_ambient_light_mac.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <IOKit/IOMessage.h> 9 #include <IOKit/IOMessage.h>
10 10
(...skipping 29 matching lines...) Expand all
40 40
41 } // namespace 41 } // namespace
42 42
43 namespace device { 43 namespace device {
44 44
45 enum LmuFunctionIndex { 45 enum LmuFunctionIndex {
46 kGetSensorReadingID = 0, // getSensorReading(int *, int *) 46 kGetSensorReadingID = 0, // getSensorReading(int *, int *)
47 }; 47 };
48 48
49 PlatformSensorAmbientLightMac::PlatformSensorAmbientLightMac( 49 PlatformSensorAmbientLightMac::PlatformSensorAmbientLightMac(
50 mojom::SensorType type,
51 mojo::ScopedSharedBufferMapping mapping, 50 mojo::ScopedSharedBufferMapping mapping,
52 PlatformSensorProvider* provider) 51 PlatformSensorProvider* provider)
53 : PlatformSensor(type, std::move(mapping), provider), 52 : PlatformSensor(mojom::SensorType::AMBIENT_LIGHT,
53 std::move(mapping),
54 provider),
54 light_sensor_port_(nullptr), 55 light_sensor_port_(nullptr),
55 current_lux_(0.0) { 56 current_lux_(0.0) {}
56 DCHECK_EQ(type, mojom::SensorType::AMBIENT_LIGHT);
57 }
58 57
59 PlatformSensorAmbientLightMac::~PlatformSensorAmbientLightMac() = default; 58 PlatformSensorAmbientLightMac::~PlatformSensorAmbientLightMac() = default;
60 59
61 mojom::ReportingMode PlatformSensorAmbientLightMac::GetReportingMode() { 60 mojom::ReportingMode PlatformSensorAmbientLightMac::GetReportingMode() {
62 return mojom::ReportingMode::ON_CHANGE; 61 return mojom::ReportingMode::ON_CHANGE;
63 } 62 }
64 63
65 bool PlatformSensorAmbientLightMac::CheckSensorConfiguration( 64 bool PlatformSensorAmbientLightMac::CheckSensorConfiguration(
66 const PlatformSensorConfiguration& configuration) { 65 const PlatformSensorConfiguration& configuration) {
67 return configuration.frequency() > 0 && 66 return configuration.frequency() > 0 &&
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 current_lux_ = lux; 166 current_lux_ = lux;
168 167
169 SensorReading reading; 168 SensorReading reading;
170 reading.timestamp = (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); 169 reading.timestamp = (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
171 reading.values[0] = current_lux_; 170 reading.values[0] = current_lux_;
172 UpdateSensorReading(reading, true); 171 UpdateSensorReading(reading, true);
173 return true; 172 return true;
174 } 173 }
175 174
176 } // namespace device 175 } // namespace device
OLDNEW
« no previous file with comments | « device/generic_sensor/platform_sensor_ambient_light_mac.h ('k') | device/generic_sensor/platform_sensor_provider_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698