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 |
11 using device::mojom::blink::SensorType; | 11 using device::mojom::blink::SensorType; |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 // static | 15 // static |
16 AmbientLightSensor* AmbientLightSensor::create(ScriptState* scriptState, | 16 AmbientLightSensor* AmbientLightSensor::create( |
17 const SensorOptions& options, | 17 ExecutionContext* executionContext, |
18 ExceptionState& exceptionState) { | 18 const SensorOptions& options, |
19 return new AmbientLightSensor(scriptState, options, exceptionState); | 19 ExceptionState& exceptionState) { |
| 20 return new AmbientLightSensor(executionContext, options, exceptionState); |
20 } | 21 } |
21 | 22 |
22 // static | 23 // static |
23 AmbientLightSensor* AmbientLightSensor::create(ScriptState* scriptState, | 24 AmbientLightSensor* AmbientLightSensor::create( |
24 ExceptionState& exceptionState) { | 25 ExecutionContext* executionContext, |
25 return create(scriptState, SensorOptions(), exceptionState); | 26 ExceptionState& exceptionState) { |
| 27 return create(executionContext, SensorOptions(), exceptionState); |
26 } | 28 } |
27 | 29 |
28 AmbientLightSensor::AmbientLightSensor(ScriptState* scriptState, | 30 AmbientLightSensor::AmbientLightSensor(ExecutionContext* executionContext, |
29 const SensorOptions& options, | 31 const SensorOptions& options, |
30 ExceptionState& exceptionState) | 32 ExceptionState& exceptionState) |
31 : Sensor(scriptState, options, exceptionState, SensorType::AMBIENT_LIGHT) {} | 33 : Sensor(executionContext, |
| 34 options, |
| 35 exceptionState, |
| 36 SensorType::AMBIENT_LIGHT) {} |
32 | 37 |
33 AmbientLightSensorReading* AmbientLightSensor::reading() const { | 38 AmbientLightSensorReading* AmbientLightSensor::reading() const { |
34 return static_cast<AmbientLightSensorReading*>(Sensor::reading()); | 39 return static_cast<AmbientLightSensorReading*>(Sensor::reading()); |
35 } | 40 } |
36 | 41 |
37 std::unique_ptr<SensorReadingFactory> | 42 std::unique_ptr<SensorReadingFactory> |
38 AmbientLightSensor::createSensorReadingFactory() { | 43 AmbientLightSensor::createSensorReadingFactory() { |
39 return std::unique_ptr<SensorReadingFactory>( | 44 return std::unique_ptr<SensorReadingFactory>( |
40 new SensorReadingFactoryImpl<AmbientLightSensorReading>()); | 45 new SensorReadingFactoryImpl<AmbientLightSensorReading>()); |
41 } | 46 } |
42 | 47 |
43 DEFINE_TRACE(AmbientLightSensor) { | 48 DEFINE_TRACE(AmbientLightSensor) { |
44 Sensor::trace(visitor); | 49 Sensor::trace(visitor); |
45 } | 50 } |
46 | 51 |
47 } // namespace blink | 52 } // namespace blink |
OLD | NEW |