| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 AmbientLightSensor::AmbientLightSensor(ScriptState* scriptState, | 28 AmbientLightSensor::AmbientLightSensor(ScriptState* scriptState, |
| 29 const SensorOptions& options, | 29 const SensorOptions& options, |
| 30 ExceptionState& exceptionState) | 30 ExceptionState& exceptionState) |
| 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 std::unique_ptr<SensorReadingFactory> |
| 38 return AmbientLightSensorReading::create(proxy); | 38 AmbientLightSensor::createSensorReadingFactory() { |
| 39 return std::unique_ptr<SensorReadingFactory>( |
| 40 new SensorReadingFactoryImpl<AmbientLightSensorReading>()); |
| 39 } | 41 } |
| 40 | 42 |
| 41 auto AmbientLightSensor::createSensorConfig( | 43 auto AmbientLightSensor::createSensorConfig( |
| 42 const SensorOptions& options, | 44 const SensorOptions& options, |
| 43 const SensorConfiguration& defaultConfig) -> SensorConfigurationPtr { | 45 const SensorConfiguration& defaultConfig) -> SensorConfigurationPtr { |
| 44 auto result = device::mojom::blink::SensorConfiguration::New(); | 46 auto result = device::mojom::blink::SensorConfiguration::New(); |
| 45 result->frequency = | 47 result->frequency = |
| 46 options.hasFrequency() ? options.frequency() : defaultConfig.frequency; | 48 options.hasFrequency() ? options.frequency() : defaultConfig.frequency; |
| 47 return result; | 49 return result; |
| 48 } | 50 } |
| 49 | 51 |
| 50 DEFINE_TRACE(AmbientLightSensor) { | 52 DEFINE_TRACE(AmbientLightSensor) { |
| 51 Sensor::trace(visitor); | 53 Sensor::trace(visitor); |
| 52 } | 54 } |
| 53 | 55 |
| 54 } // namespace blink | 56 } // namespace blink |
| OLD | NEW |