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

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

Issue 2668173003: [Sensors] Remove SensorReading interfaces (Closed)
Patch Set: updated global-interface-listing.html Created 3 years, 10 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/sensor/Magnetometer.h" 5 #include "modules/sensor/Magnetometer.h"
6 6
7 #include "modules/sensor/MagnetometerReading.h"
8
9 using device::mojom::blink::SensorType; 7 using device::mojom::blink::SensorType;
10 8
11 namespace blink { 9 namespace blink {
12 10
13 // static 11 // static
14 Magnetometer* Magnetometer::create(ExecutionContext* executionContext, 12 Magnetometer* Magnetometer::create(ExecutionContext* executionContext,
15 const SensorOptions& options, 13 const SensorOptions& options,
16 ExceptionState& exceptionState) { 14 ExceptionState& exceptionState) {
17 return new Magnetometer(executionContext, options, exceptionState); 15 return new Magnetometer(executionContext, options, exceptionState);
18 } 16 }
19 17
20 // static 18 // static
21 Magnetometer* Magnetometer::create(ExecutionContext* executionContext, 19 Magnetometer* Magnetometer::create(ExecutionContext* executionContext,
22 ExceptionState& exceptionState) { 20 ExceptionState& exceptionState) {
23 return create(executionContext, SensorOptions(), exceptionState); 21 return create(executionContext, SensorOptions(), exceptionState);
24 } 22 }
25 23
26 Magnetometer::Magnetometer(ExecutionContext* executionContext, 24 Magnetometer::Magnetometer(ExecutionContext* executionContext,
27 const SensorOptions& options, 25 const SensorOptions& options,
28 ExceptionState& exceptionState) 26 ExceptionState& exceptionState)
29 : Sensor(executionContext, 27 : Sensor(executionContext,
30 options, 28 options,
31 exceptionState, 29 exceptionState,
32 SensorType::MAGNETOMETER) {} 30 SensorType::MAGNETOMETER) {}
33 31
34 MagnetometerReading* Magnetometer::reading() const { 32 double Magnetometer::x(bool& isNull) const {
35 return static_cast<MagnetometerReading*>(Sensor::reading()); 33 return readingValue(0, isNull);
36 } 34 }
37 35
38 std::unique_ptr<SensorReadingFactory> 36 double Magnetometer::y(bool& isNull) const {
39 Magnetometer::createSensorReadingFactory() { 37 return readingValue(1, isNull);
40 return WTF::makeUnique<SensorReadingFactoryImpl<MagnetometerReading>>(); 38 }
39
40 double Magnetometer::z(bool& isNull) const {
41 return readingValue(2, isNull);
41 } 42 }
42 43
43 DEFINE_TRACE(Magnetometer) { 44 DEFINE_TRACE(Magnetometer) {
44 Sensor::trace(visitor); 45 Sensor::trace(visitor);
45 } 46 }
46 47
47 } // namespace blink 48 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/Magnetometer.h ('k') | third_party/WebKit/Source/modules/sensor/Magnetometer.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698