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

Side by Side Diff: third_party/WebKit/Source/modules/sensor/Sensor.h

Issue 1942663003: [sensors]: Introduce the Generic Sensor API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase , m_sensorReading and options are private Created 4 years, 7 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
(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"
10 #include "bindings/core/v8/ScriptWrappable.h"
11 #include "core/dom/ActiveDOMObject.h"
12 #include "core/dom/ContextLifecycleObserver.h"
13 #include "modules/EventTargetModules.h"
14 #include "modules/ModulesExport.h"
15 #include "modules/sensor/SensorOptions.h"
16 #include "modules/sensor/SensorReading.h"
17 #include "modules/sensor/sensor_state_type.h"
18 #include "platform/heap/Handle.h"
19
20 namespace blink {
21
22 class ExceptionState;
23 class ScriptState;
24 class SensorReading;
25
26 class MODULES_EXPORT Sensor
27 : public EventTargetWithInlineData
28 , public ActiveScriptWrappable
29 , public ActiveDOMObject {
30 USING_GARBAGE_COLLECTED_MIXIN(Sensor);
31 DEFINE_WRAPPERTYPEINFO();
32
33 public:
34 ~Sensor() override;
35
36 virtual void start(ScriptState*, ExceptionState&) = 0;
37 virtual void stop(ScriptState*, ExceptionState&) = 0;
38
39 // EventTarget implementation.
40 const AtomicString& interfaceName() const override { return EventTargetNames ::Sensor; }
41 ExecutionContext* getExecutionContext() const override { return ContextLifec ycleObserver::getExecutionContext(); }
42
43 // Getters
44 String state() const;
45 SensorReading* reading() const;
46
47 DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
48 DEFINE_ATTRIBUTE_EVENT_LISTENER(change);
49 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange);
50
51 // ActiveDOMObject implementation.
52 void suspend() override;
53 void resume() override;
54 void stop() override;
55
56 DECLARE_VIRTUAL_TRACE();
57
58 protected:
59 Sensor(ExecutionContext*, const SensorOptions&);
60 SensorState m_sensorState;
61
62 private:
63 Member<SensorReading> m_sensorReading;
64 SensorOptions m_sensorOptions;
65 };
66
67 } // namespace blink
68
69 #endif // Sensor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698