Index: third_party/WebKit/Source/modules/sensor/Sensor.h |
diff --git a/third_party/WebKit/Source/modules/sensor/Sensor.h b/third_party/WebKit/Source/modules/sensor/Sensor.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..91862a2e43e7dd9e8f60e756b63897cf87030e76 |
--- /dev/null |
+++ b/third_party/WebKit/Source/modules/sensor/Sensor.h |
@@ -0,0 +1,73 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef Sensor_h |
+#define Sensor_h |
+ |
+#include "bindings/core/v8/ActiveScriptWrappable.h" |
+#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()
|
+#include "bindings/core/v8/ScriptWrappable.h" |
+#include "core/dom/ActiveDOMObject.h" |
+#include "core/dom/ContextLifecycleObserver.h" |
+#include "core/frame/PlatformEventController.h" |
+#include "modules/EventTargetModules.h" |
+#include "modules/ModulesExport.h" |
+#include "modules/sensor/SensorOptions.h" |
+#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.
|
+#include "modules/sensor/sensor_state_type.h" |
+#include "platform/heap/Handle.h" |
+ |
+namespace blink { |
+ |
+class ExceptionState; |
+class ScriptState; |
+class SensorReading; |
+ |
+class MODULES_EXPORT Sensor |
+ : 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
|
+ , public ActiveScriptWrappable |
+ , public ActiveDOMObject |
+ , public PlatformEventController { |
+ USING_GARBAGE_COLLECTED_MIXIN(Sensor); |
+ DEFINE_WRAPPERTYPEINFO(); |
+ |
+public: |
+ ~Sensor() override; |
+ |
+ void start(ScriptState*, ExceptionState&); |
+ void stop(ScriptState*, ExceptionState&); |
+ void updateState(SensorState); |
+ |
+ // EventTarget implementation. |
+ const AtomicString& interfaceName() const override { return EventTargetNames::Sensor; } |
+ ExecutionContext* getExecutionContext() const override { return ContextLifecycleObserver::getExecutionContext(); } |
+ |
+ // Getters |
+ String state() const; |
+ SensorReading* reading() const; |
+ |
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(error); |
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(change); |
+ DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange); |
+ |
+ // ActiveDOMObject implementation. |
+ void suspend() override; |
+ void resume() override; |
+ void stop() override; |
+ bool hasPendingActivity() const override; |
+ |
+ DECLARE_VIRTUAL_TRACE(); |
+ |
+protected: |
+ Sensor(ExecutionContext*, const SensorOptions&); |
+ SensorState m_sensorState; |
+ |
+private: |
+ 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
|
+ SensorOptions m_sensorOptions; |
timvolodine
2016/05/24 15:30:35
and this?
riju_
2016/05/25 15:07:18
same
|
+}; |
+ |
+} // namespace blink |
+ |
+#endif // Sensor_h |