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

Side by Side Diff: third_party/WebKit/Source/modules/sensor/AmbientLightSensor.cpp

Issue 2668173003: [Sensors] Remove SensorReading interfaces (Closed)
Patch Set: updated global-interface-listing.html Created 3 years, 10 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 "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"
10 9
11 using device::mojom::blink::SensorType; 10 using device::mojom::blink::SensorType;
12 11
13 namespace blink { 12 namespace blink {
14 13
15 // static 14 // static
16 AmbientLightSensor* AmbientLightSensor::create( 15 AmbientLightSensor* AmbientLightSensor::create(
17 ExecutionContext* executionContext, 16 ExecutionContext* executionContext,
18 const SensorOptions& options, 17 const SensorOptions& options,
19 ExceptionState& exceptionState) { 18 ExceptionState& exceptionState) {
20 return new AmbientLightSensor(executionContext, options, exceptionState); 19 return new AmbientLightSensor(executionContext, options, exceptionState);
21 } 20 }
22 21
23 // static 22 // static
24 AmbientLightSensor* AmbientLightSensor::create( 23 AmbientLightSensor* AmbientLightSensor::create(
25 ExecutionContext* executionContext, 24 ExecutionContext* executionContext,
26 ExceptionState& exceptionState) { 25 ExceptionState& exceptionState) {
27 return create(executionContext, SensorOptions(), exceptionState); 26 return create(executionContext, SensorOptions(), exceptionState);
28 } 27 }
29 28
30 AmbientLightSensor::AmbientLightSensor(ExecutionContext* executionContext, 29 AmbientLightSensor::AmbientLightSensor(ExecutionContext* executionContext,
31 const SensorOptions& options, 30 const SensorOptions& options,
32 ExceptionState& exceptionState) 31 ExceptionState& exceptionState)
33 : Sensor(executionContext, 32 : Sensor(executionContext,
34 options, 33 options,
35 exceptionState, 34 exceptionState,
36 SensorType::AMBIENT_LIGHT) {} 35 SensorType::AMBIENT_LIGHT) {}
37 36
38 AmbientLightSensorReading* AmbientLightSensor::reading() const { 37 double AmbientLightSensor::illuminance(bool& isNull) const {
39 return static_cast<AmbientLightSensorReading*>(Sensor::reading()); 38 return readingValue(0, isNull);
40 }
41
42 std::unique_ptr<SensorReadingFactory>
43 AmbientLightSensor::createSensorReadingFactory() {
44 return std::unique_ptr<SensorReadingFactory>(
45 new SensorReadingFactoryImpl<AmbientLightSensorReading>());
46 } 39 }
47 40
48 DEFINE_TRACE(AmbientLightSensor) { 41 DEFINE_TRACE(AmbientLightSensor) {
49 Sensor::trace(visitor); 42 Sensor::trace(visitor);
50 } 43 }
51 44
52 } // namespace blink 45 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698