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 "modules/sensor/AmbientLightSensor.h" | 5 #include "modules/sensor/AmbientLightSensor.h" |
6 | 6 |
7 #include "bindings/core/v8/ScriptPromise.h" | 7 #include "bindings/core/v8/ScriptPromise.h" |
8 #include "bindings/core/v8/ScriptPromiseResolver.h" | 8 #include "bindings/core/v8/ScriptPromiseResolver.h" |
9 #include "modules/sensor/AmbientLightSensorReading.h" | 9 #include "modules/sensor/AmbientLightSensorReading.h" |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 : Sensor(scriptState, options, exceptionState, SensorType::AMBIENT_LIGHT) {} | 31 : Sensor(scriptState, options, exceptionState, SensorType::AMBIENT_LIGHT) {} |
32 | 32 |
33 AmbientLightSensorReading* AmbientLightSensor::reading() const { | 33 AmbientLightSensorReading* AmbientLightSensor::reading() const { |
34 return static_cast<AmbientLightSensorReading*>(Sensor::reading()); | 34 return static_cast<AmbientLightSensorReading*>(Sensor::reading()); |
35 } | 35 } |
36 | 36 |
37 SensorReading* AmbientLightSensor::createSensorReading(SensorProxy* proxy) { | 37 SensorReading* AmbientLightSensor::createSensorReading(SensorProxy* proxy) { |
38 return AmbientLightSensorReading::create(proxy); | 38 return AmbientLightSensorReading::create(proxy); |
39 } | 39 } |
40 | 40 |
41 auto AmbientLightSensor::createSensorConfig( | |
42 const SensorOptions& options, | |
43 const SensorConfiguration& defaultConfig) -> SensorConfigurationPtr { | |
44 auto result = device::mojom::blink::SensorConfiguration::New(); | |
45 result->frequency = | |
46 options.hasFrequency() ? options.frequency() : defaultConfig.frequency; | |
47 return result; | |
48 } | |
49 | |
50 DEFINE_TRACE(AmbientLightSensor) { | 41 DEFINE_TRACE(AmbientLightSensor) { |
51 Sensor::trace(visitor); | 42 Sensor::trace(visitor); |
52 } | 43 } |
53 | 44 |
54 } // namespace blink | 45 } // namespace blink |
OLD | NEW |