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

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

Issue 2472403002: [Sensors] Align sensor reading attribute implementation with the specification (Closed)
Patch Set: Comments from Tim 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 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 #ifndef Sensor_h 5 #ifndef Sensor_h
6 #define Sensor_h 6 #define Sensor_h
7 7
8 #include "bindings/core/v8/ActiveScriptWrappable.h" 8 #include "bindings/core/v8/ActiveScriptWrappable.h"
9 #include "bindings/core/v8/ScriptWrappable.h" 9 #include "bindings/core/v8/ScriptWrappable.h"
10 #include "core/dom/ActiveDOMObject.h" 10 #include "core/dom/ActiveDOMObject.h"
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // ActiveScriptWrappable overrides. 59 // ActiveScriptWrappable overrides.
60 bool hasPendingActivity() const override; 60 bool hasPendingActivity() const override;
61 61
62 DECLARE_VIRTUAL_TRACE(); 62 DECLARE_VIRTUAL_TRACE();
63 63
64 protected: 64 protected:
65 Sensor(ScriptState*, 65 Sensor(ScriptState*,
66 const SensorOptions&, 66 const SensorOptions&,
67 ExceptionState&, 67 ExceptionState&,
68 device::mojom::blink::SensorType); 68 device::mojom::blink::SensorType);
69 virtual SensorReading* createSensorReading(SensorProxy*) = 0; 69 virtual std::unique_ptr<SensorReadingFactory>
70 createSensorReadingFactory() = 0;
70 71
71 using SensorConfigurationPtr = device::mojom::blink::SensorConfigurationPtr; 72 using SensorConfigurationPtr = device::mojom::blink::SensorConfigurationPtr;
72 using SensorConfiguration = device::mojom::blink::SensorConfiguration; 73 using SensorConfiguration = device::mojom::blink::SensorConfiguration;
73 virtual SensorConfigurationPtr createSensorConfig( 74 virtual SensorConfigurationPtr createSensorConfig(
74 const SensorOptions&, 75 const SensorOptions&,
75 const SensorConfiguration& defaultConfiguration) = 0; 76 const SensorConfiguration& defaultConfiguration) = 0;
76 77
77 private: 78 private:
78 void initSensorProxyIfNeeded(); 79 void initSensorProxyIfNeeded();
79 80
(...skipping 24 matching lines...) Expand all
104 const String& sanitizedMessage = String(), 105 const String& sanitizedMessage = String(),
105 const String& unsanitizedMessage = String()); 106 const String& unsanitizedMessage = String());
106 107
107 void updatePollingStatus(); 108 void updatePollingStatus();
108 109
109 void notifySensorReadingChanged(); 110 void notifySensorReadingChanged();
110 void notifyStateChanged(); 111 void notifyStateChanged();
111 void notifyError(DOMException* error); 112 void notifyError(DOMException* error);
112 113
113 private: 114 private:
114 Member<SensorReading> m_sensorReading;
115 SensorOptions m_sensorOptions; 115 SensorOptions m_sensorOptions;
116 device::mojom::blink::SensorType m_type; 116 device::mojom::blink::SensorType m_type;
117 SensorState m_state; 117 SensorState m_state;
118 Member<SensorProxy> m_sensorProxy; 118 Member<SensorProxy> m_sensorProxy;
119 std::unique_ptr<SensorPollingStrategy> m_polling; 119 std::unique_ptr<SensorPollingStrategy> m_polling;
120 SensorProxy::Reading m_storedData; 120 device::SensorReading m_storedData;
121 SensorConfigurationPtr m_configuration; 121 SensorConfigurationPtr m_configuration;
122 }; 122 };
123 123
124 } // namespace blink 124 } // namespace blink
125 125
126 #endif // Sensor_h 126 #endif // Sensor_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/BUILD.gn ('k') | third_party/WebKit/Source/modules/sensor/Sensor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698