OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "modules/sensor/AmbientLightSensor.h" | |
6 | |
7 #include "bindings/core/v8/ScriptPromise.h" | |
8 #include "bindings/core/v8/ScriptPromiseResolver.h" | |
9 #include "modules/sensor/AmbientLightSensorReading.h" | |
10 | |
11 using device::mojom::blink::SensorType; | |
12 | |
13 namespace blink { | |
14 | |
15 // static | |
16 AmbientLightSensor* AmbientLightSensor::create(ExecutionContext* context, const SensorOptions& sensorOptions) | |
17 { | |
18 AmbientLightSensor* sensor = new AmbientLightSensor(context, sensorOptions); | |
19 return sensor; | |
haraken
2016/09/13 09:45:04
return new ...;
shalamov
2016/09/13 10:34:17
Done.
| |
20 } | |
21 | |
22 // static | |
23 AmbientLightSensor* AmbientLightSensor::create(ExecutionContext* context) | |
24 { | |
25 return create(context, SensorOptions()); | |
26 } | |
27 | |
28 AmbientLightSensor::AmbientLightSensor(ExecutionContext* executionContext, const SensorOptions& sensorOptions) | |
29 : Sensor(executionContext, sensorOptions, SensorType::AMBIENT_LIGHT) | |
30 { | |
31 } | |
32 | |
33 AmbientLightSensorReading* AmbientLightSensor::reading() const | |
34 { | |
35 return static_cast<AmbientLightSensorReading*>(Sensor::reading()); | |
36 } | |
37 | |
38 SensorReading* AmbientLightSensor::createSensorReading(SensorProxy* proxy) | |
39 { | |
40 return AmbientLightSensorReading::create(proxy); | |
41 } | |
42 | |
43 auto AmbientLightSensor::createSensorConfig(const SensorOptions& options, const SensorConfiguration& defaultConfig) -> SensorConfigurationPtr | |
44 { | |
45 auto result = device::mojom::blink::SensorConfiguration::New(); | |
46 result->frequency = options.hasFrequency() ? options.frequency() : defaultCo nfig.frequency; | |
47 return result; | |
48 } | |
49 | |
50 DEFINE_TRACE(AmbientLightSensor) | |
51 { | |
52 Sensor::trace(visitor); | |
53 } | |
54 | |
55 } // namespace blink | |
OLD | NEW |