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

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

Issue 1892083002: Generic Sensor API : Ambient Light Sensor API. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 #include "modules/sensor/Sensor.h"
6
7 #include "bindings/core/v8/ScriptPromise.h"
8 #include "bindings/core/v8/ScriptPromiseResolver.h"
9 #include "core/dom/DOMException.h"
10 #include "core/dom/ExceptionCode.h"
11 #include "modules/sensor/SensorReading.h"
12
13 namespace blink {
14
15 Sensor::~Sensor()
16 {
17 }
18
19 Sensor::Sensor(ExecutionContext* executionContext, const SensorOptions& sensorOp tions)
20 : ActiveScriptWrappable(this)
21 , ActiveDOMObject(executionContext)
22 , m_sensorState(SensorState::Idle)
23 {
24 }
25
26 // Getters
27 String Sensor::state()
28 {
29 switch (m_sensorState) {
30 case SensorState::Idle:
31 return "idle";
32 case SensorState::Activating:
33 return "activating";
34 case SensorState::Active:
35 return "active";
36 case SensorState::Errored:
37 return "errored";
38 }
39 ASSERT_NOT_REACHED();
40 return "idle";
41 }
42
43 SensorReading& Sensor::reading()
44 {
45 return *m_sensorReading.get();
46 }
47
48 void Sensor::updateState(SensorState newState)
49 {
50 }
51
52 void Sensor::suspend()
53 {
54 }
55
56 void Sensor::resume()
57 {
58 }
59
60 void Sensor::stop()
61 {
62 }
63
64 bool Sensor::hasPendingActivity() const
65 {
66 return false;
67 }
68
69 DEFINE_TRACE(Sensor)
70 {
71 ActiveDOMObject::trace(visitor);
72 EventTargetWithInlineData::trace(visitor);
73 visitor->trace(m_sensorReading);
74 }
75
76 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698