OLD | NEW |
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" |
11 #include "core/dom/ContextLifecycleObserver.h" | 11 #include "core/dom/ContextLifecycleObserver.h" |
12 #include "core/frame/PlatformEventController.h" | 12 #include "core/frame/PlatformEventController.h" |
13 #include "core/page/PageVisibilityObserver.h" | 13 #include "core/page/PageVisibilityObserver.h" |
14 #include "modules/EventTargetModules.h" | 14 #include "modules/EventTargetModules.h" |
15 #include "modules/sensor/SensorOptions.h" | 15 #include "modules/sensor/SensorOptions.h" |
16 #include "modules/sensor/SensorProxy.h" | 16 #include "modules/sensor/SensorProxy.h" |
17 #include "platform/heap/Handle.h" | 17 #include "platform/heap/Handle.h" |
| 18 #include "public/platform/modules/permissions/permission.mojom-blink.h" |
| 19 #include "public/platform/modules/permissions/permission_status.mojom-blink.h" |
18 | 20 |
19 namespace blink { | 21 namespace blink { |
20 | 22 |
21 class ExceptionState; | 23 class ExceptionState; |
22 class ScriptState; | 24 class ScriptState; |
23 class SensorReading; | 25 class SensorReading; |
24 class SensorPollingStrategy; | 26 class SensorPollingStrategy; |
25 | 27 |
26 class Sensor : public EventTargetWithInlineData, | 28 class Sensor : public EventTargetWithInlineData, |
27 public ActiveScriptWrappable, | 29 public ActiveScriptWrappable, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 void reportError(ExceptionCode = UnknownError, | 105 void reportError(ExceptionCode = UnknownError, |
104 const String& sanitizedMessage = String(), | 106 const String& sanitizedMessage = String(), |
105 const String& unsanitizedMessage = String()); | 107 const String& unsanitizedMessage = String()); |
106 | 108 |
107 void updatePollingStatus(); | 109 void updatePollingStatus(); |
108 | 110 |
109 void notifySensorReadingChanged(); | 111 void notifySensorReadingChanged(); |
110 void notifyStateChanged(); | 112 void notifyStateChanged(); |
111 void notifyError(DOMException* error); | 113 void notifyError(DOMException* error); |
112 | 114 |
| 115 mojom::blink::PermissionService* getPermissionService(ExecutionContext*); |
| 116 void permissionServiceConnectionError(); |
| 117 void onPermissionUpdate(ExecutionContext*, mojom::blink::PermissionStatus); |
| 118 void requestPermission(ExecutionContext*, mojom::blink::PermissionStatus); |
| 119 |
113 private: | 120 private: |
114 Member<SensorReading> m_sensorReading; | 121 Member<SensorReading> m_sensorReading; |
115 SensorOptions m_sensorOptions; | 122 SensorOptions m_sensorOptions; |
116 device::mojom::blink::SensorType m_type; | 123 device::mojom::blink::SensorType m_type; |
117 SensorState m_state; | 124 SensorState m_state; |
118 Member<SensorProxy> m_sensorProxy; | 125 Member<SensorProxy> m_sensorProxy; |
119 std::unique_ptr<SensorPollingStrategy> m_polling; | 126 std::unique_ptr<SensorPollingStrategy> m_polling; |
120 SensorProxy::Reading m_storedData; | 127 SensorProxy::Reading m_storedData; |
121 SensorConfigurationPtr m_configuration; | 128 SensorConfigurationPtr m_configuration; |
| 129 |
| 130 mojom::blink::PermissionStatus m_sensorPermission; |
| 131 |
| 132 mojom::blink::PermissionServicePtr m_permissionService; |
122 }; | 133 }; |
123 | 134 |
124 } // namespace blink | 135 } // namespace blink |
125 | 136 |
126 #endif // Sensor_h | 137 #endif // Sensor_h |
OLD | NEW |