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 #ifndef AmbientLightSensor_h | |
6 #define AmbientLightSensor_h | |
7 | |
8 #include "bindings/core/v8/ScriptPromise.h" | |
9 #include "bindings/core/v8/ScriptPromiseProperty.h" | |
10 #include "bindings/core/v8/ScriptWrappable.h" | |
11 #include "core/dom/ActiveDOMObject.h" | |
12 #include "core/dom/ContextLifecycleObserver.h" | |
13 #include "core/frame/PlatformEventController.h" | |
14 #include "modules/EventTargetModules.h" | |
15 #include "modules/ModulesExport.h" | |
16 #include "modules/sensor/AmbientLightSensorReading.h" | |
17 #include "modules/sensor/Sensor.h" | |
18 #include "modules/sensor/SensorOptions.h" | |
19 #include "modules/sensor/als_reading.h" | |
20 #include "modules/sensor/sensor_state_type.h" | |
21 #include "platform/heap/Handle.h" | |
22 #include "wtf/text/WTFString.h" | |
23 | |
24 namespace blink { | |
25 | |
26 class ExceptionState; | |
27 class ScriptState; | |
28 | |
29 class AmbientLightSensor | |
30 : public Sensor | |
31 , public PlatformEventController { | |
32 USING_GARBAGE_COLLECTED_MIXIN(AmbientLightSensor); | |
33 DEFINE_WRAPPERTYPEINFO(); | |
34 | |
35 public: | |
36 static AmbientLightSensor* create(ExecutionContext*, SensorOptions, Exceptio nState&); | |
37 static AmbientLightSensor* create(ExecutionContext*, ExceptionState&); | |
38 | |
39 ~AmbientLightSensor() override; | |
40 | |
41 // From Sensor. | |
42 void start(ScriptState*, ExceptionState&) override; | |
43 void stop(ScriptState*, ExceptionState&) override; | |
44 void updateState(SensorState) override; | |
45 | |
46 // Getters | |
47 AmbientLightSensorReading& reading(); | |
48 | |
49 // Inherited from PlatformEventController. | |
50 void didUpdateData() override; | |
51 void registerWithDispatcher() override; | |
52 void unregisterWithDispatcher() override; | |
53 bool hasLastData() override; | |
54 | |
55 // ActiveDOMObject implementation. | |
56 void suspend() override; | |
57 void resume() override; | |
58 void stop() override; | |
59 bool hasPendingActivity() const override; | |
60 | |
61 DECLARE_VIRTUAL_TRACE(); | |
62 | |
63 private: | |
64 AmbientLightSensor(ExecutionContext*, SensorOptions); | |
65 | |
66 Member<AmbientLightSensorReading> m_lightReading; | |
timvolodine
2016/05/06 17:05:41
does this mean we have two readings now? one from
riju_
2016/05/16 16:58:51
We can make SensorReading and SensorOptions privat
timvolodine
2016/05/17 17:46:18
I think the idea would be to use the member of Sen
| |
67 }; | |
68 | |
69 } // namespace blink | |
70 | |
71 #endif // AmbientLightSensor_h | |
OLD | NEW |