Index: third_party/WebKit/Source/modules/sensor/Sensor.cpp |
diff --git a/third_party/WebKit/Source/modules/sensor/Sensor.cpp b/third_party/WebKit/Source/modules/sensor/Sensor.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..18fb33402400c7882cf5b313a5926f05d750aa53 |
--- /dev/null |
+++ b/third_party/WebKit/Source/modules/sensor/Sensor.cpp |
@@ -0,0 +1,76 @@ |
+// 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. |
+ |
+#include "modules/sensor/Sensor.h" |
+ |
+#include "bindings/core/v8/ScriptPromise.h" |
+#include "bindings/core/v8/ScriptPromiseResolver.h" |
+#include "core/dom/DOMException.h" |
+#include "core/dom/ExceptionCode.h" |
+#include "modules/sensor/SensorReading.h" |
+ |
+namespace blink { |
+ |
+Sensor::~Sensor() |
+{ |
+} |
+ |
+Sensor::Sensor(ExecutionContext* executionContext, const SensorOptions& sensorOptions) |
+ : ActiveScriptWrappable(this) |
+ , ActiveDOMObject(executionContext) |
+ , m_sensorState(SensorState::Idle) |
+{ |
+} |
+ |
+// Getters |
+String Sensor::state() |
+{ |
+ switch (m_sensorState) { |
+ case SensorState::Idle: |
+ return "idle"; |
+ case SensorState::Activating: |
+ return "activating"; |
+ case SensorState::Active: |
+ return "active"; |
+ case SensorState::Errored: |
+ return "errored"; |
+ } |
+ ASSERT_NOT_REACHED(); |
+ return "idle"; |
+} |
+ |
+SensorReading& Sensor::reading() |
+{ |
+ return *m_sensorReading.get(); |
+} |
+ |
+void Sensor::updateState(SensorState newState) |
+{ |
+} |
+ |
+void Sensor::suspend() |
+{ |
+} |
+ |
+void Sensor::resume() |
+{ |
+} |
+ |
+void Sensor::stop() |
+{ |
+} |
+ |
+bool Sensor::hasPendingActivity() const |
+{ |
+ return false; |
+} |
+ |
+DEFINE_TRACE(Sensor) |
+{ |
+ ActiveDOMObject::trace(visitor); |
+ EventTargetWithInlineData::trace(visitor); |
+ visitor->trace(m_sensorReading); |
+} |
+ |
+} // namespace blink |