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 Sensor_h | |
6 #define Sensor_h | |
7 | |
8 #include "bindings/core/v8/ActiveScriptWrappable.h" | |
9 #include "bindings/core/v8/ScriptPromise.h" | |
timvolodine
2016/05/24 15:30:35
is this needed?
riju_
2016/05/25 15:07:18
No. Sorry, an older version used requestReading()
| |
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/SensorOptions.h" | |
17 #include "modules/sensor/SensorReading.h" | |
timvolodine
2016/05/24 15:30:35
you are forward declaring it below? just remove th
riju_
2016/05/25 15:07:18
Done.
| |
18 #include "modules/sensor/sensor_state_type.h" | |
19 #include "platform/heap/Handle.h" | |
20 | |
21 namespace blink { | |
22 | |
23 class ExceptionState; | |
24 class ScriptState; | |
25 class SensorReading; | |
26 | |
27 class MODULES_EXPORT Sensor | |
28 : public EventTargetWithInlineData | |
timvolodine
2016/05/24 15:30:35
I think we usually put commas on previous line ?
riju_
2016/05/25 15:07:18
Chromium style "clang-format" puts commas on previ
| |
29 , public ActiveScriptWrappable | |
30 , public ActiveDOMObject | |
31 , public PlatformEventController { | |
32 USING_GARBAGE_COLLECTED_MIXIN(Sensor); | |
33 DEFINE_WRAPPERTYPEINFO(); | |
34 | |
35 public: | |
36 ~Sensor() override; | |
37 | |
38 void start(ScriptState*, ExceptionState&); | |
39 void stop(ScriptState*, ExceptionState&); | |
40 void updateState(SensorState); | |
41 | |
42 // EventTarget implementation. | |
43 const AtomicString& interfaceName() const override { return EventTargetNames ::Sensor; } | |
44 ExecutionContext* getExecutionContext() const override { return ContextLifec ycleObserver::getExecutionContext(); } | |
45 | |
46 // Getters | |
47 String state() const; | |
48 SensorReading* reading() const; | |
49 | |
50 DEFINE_ATTRIBUTE_EVENT_LISTENER(error); | |
51 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); | |
52 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); | |
53 | |
54 // ActiveDOMObject implementation. | |
55 void suspend() override; | |
56 void resume() override; | |
57 void stop() override; | |
58 bool hasPendingActivity() const override; | |
59 | |
60 DECLARE_VIRTUAL_TRACE(); | |
61 | |
62 protected: | |
63 Sensor(ExecutionContext*, const SensorOptions&); | |
64 SensorState m_sensorState; | |
65 | |
66 private: | |
67 Member<SensorReading> m_sensorReading; | |
timvolodine
2016/05/24 15:30:35
probably also protected?
riju_
2016/05/25 15:07:17
In a previous patchset, i made it private to restr
| |
68 SensorOptions m_sensorOptions; | |
timvolodine
2016/05/24 15:30:35
and this?
riju_
2016/05/25 15:07:18
same
| |
69 }; | |
70 | |
71 } // namespace blink | |
72 | |
73 #endif // Sensor_h | |
OLD | NEW |