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

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 + remove state from global interface listing 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 "platform/heap/Handle.h"
18
19 namespace blink {
20
21 class ExceptionState;
22 class ScriptState;
23 class SensorReading;
24
25 class MODULES_EXPORT Sensor
26 : public EventTargetWithInlineData
27 , public ActiveScriptWrappable
28 , public ActiveDOMObject {
29 USING_GARBAGE_COLLECTED_MIXIN(Sensor);
30 DEFINE_WRAPPERTYPEINFO();
31
32 public:
33 ~Sensor() override;
34
35 virtual void start(ScriptState*, ExceptionState&) = 0;
36 virtual void stop(ScriptState*, ExceptionState&) = 0;
37
38 // EventTarget implementation.
39 const AtomicString& interfaceName() const override { return EventTargetNames ::Sensor; }
40 ExecutionContext* getExecutionContext() const override { return ContextLifec ycleObserver::getExecutionContext(); }
41
42 // Getters
43 SensorReading& reading();
44
45 DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
46 DEFINE_ATTRIBUTE_EVENT_LISTENER(change);
47 DEFINE_ATTRIBUTE_EVENT_LISTENER(statechange);
48
49 // ActiveDOMObject implementation.
50 void suspend() override;
51 void resume() override;
52 void stop() override;
53
54 // ActiveScriptWrappable implementation.
55 bool hasPendingActivity() const override;
56
57 DECLARE_VIRTUAL_TRACE();
58
59 protected:
60 Sensor(ExecutionContext*, const SensorOptions&);
61
62 SensorOptions m_sensorOptions;
63 Member<SensorReading> m_sensorReading;
64 };
65
66 } // namespace blink
67
68 #endif // Sensor_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698