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

Unified Diff: third_party/WebKit/Source/modules/sensor/Gyroscope.cpp

Issue 2506903003: [sensors] Gyroscope sensor bindings implementation (Closed)
Patch Set: Comments + rebase Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/sensor/Gyroscope.cpp
diff --git a/third_party/WebKit/Source/modules/sensor/Gyroscope.cpp b/third_party/WebKit/Source/modules/sensor/Gyroscope.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..c278f27a975d812793ebb9dc6c99238d3a4d67fc
--- /dev/null
+++ b/third_party/WebKit/Source/modules/sensor/Gyroscope.cpp
@@ -0,0 +1,42 @@
+// 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/Gyroscope.h"
+
+#include "modules/sensor/GyroscopeReading.h"
+
+using device::mojom::blink::SensorType;
+
+namespace blink {
+
+Gyroscope* Gyroscope::create(ScriptState* scriptState,
+ const SensorOptions& options,
+ ExceptionState& exceptionState) {
+ return new Gyroscope(scriptState, options, exceptionState);
+}
+
+// static
+Gyroscope* Gyroscope::create(ScriptState* scriptState,
+ ExceptionState& exceptionState) {
+ return create(scriptState, SensorOptions(), exceptionState);
+}
+
+Gyroscope::Gyroscope(ScriptState* scriptState,
+ const SensorOptions& options,
+ ExceptionState& exceptionState)
+ : Sensor(scriptState, options, exceptionState, SensorType::GYROSCOPE) {}
+
+GyroscopeReading* Gyroscope::reading() const {
+ return static_cast<GyroscopeReading*>(Sensor::reading());
+}
+
+std::unique_ptr<SensorReadingFactory> Gyroscope::createSensorReadingFactory() {
+ return makeUnique<SensorReadingFactoryImpl<GyroscopeReading>>();
+}
+
+DEFINE_TRACE(Gyroscope) {
+ Sensor::trace(visitor);
+}
+
+} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/Gyroscope.h ('k') | third_party/WebKit/Source/modules/sensor/Gyroscope.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698