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 SensorProviderProxy_h | 5 #ifndef SensorProviderProxy_h |
6 #define SensorProviderProxy_h | 6 #define SensorProviderProxy_h |
7 | 7 |
| 8 #include "core/dom/ExecutionContext.h" |
8 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
9 #include "device/generic_sensor/public/interfaces/sensor.mojom-blink.h" | 10 #include "device/generic_sensor/public/interfaces/sensor.mojom-blink.h" |
10 #include "device/generic_sensor/public/interfaces/sensor_provider.mojom-blink.h" | 11 #include "device/generic_sensor/public/interfaces/sensor_provider.mojom-blink.h" |
11 #include "platform/Supplementable.h" | 12 #include "platform/Supplementable.h" |
12 #include "platform/heap/Handle.h" | 13 #include "platform/heap/Handle.h" |
| 14 #include "public/platform/modules/permissions/permission.mojom-blink.h" |
13 | 15 |
14 namespace blink { | 16 namespace blink { |
15 | 17 |
16 class SensorProxy; | 18 class SensorProxy; |
17 class SensorReadingFactory; | 19 class SensorReadingFactory; |
18 | 20 |
19 // This class wraps 'SensorProvider' mojo interface and it manages | 21 // This class wraps 'SensorProvider' mojo interface and it manages |
20 // 'SensorProxy' instances. | 22 // 'SensorProxy' instances. |
21 class SensorProviderProxy final | 23 class SensorProviderProxy final |
22 : public GarbageCollectedFinalized<SensorProviderProxy>, | 24 : public GarbageCollectedFinalized<SensorProviderProxy>, |
23 public Supplement<LocalFrame> { | 25 public Supplement<LocalFrame> { |
24 USING_GARBAGE_COLLECTED_MIXIN(SensorProviderProxy); | 26 USING_GARBAGE_COLLECTED_MIXIN(SensorProviderProxy); |
25 WTF_MAKE_NONCOPYABLE(SensorProviderProxy); | 27 WTF_MAKE_NONCOPYABLE(SensorProviderProxy); |
26 | 28 |
27 public: | 29 public: |
28 static SensorProviderProxy* from(LocalFrame*); | 30 static SensorProviderProxy* from(LocalFrame*); |
29 | 31 |
30 ~SensorProviderProxy(); | 32 ~SensorProviderProxy(); |
31 | 33 |
32 SensorProxy* createSensor(device::mojom::blink::SensorType, | 34 SensorProxy* createSensor(device::mojom::blink::SensorType, |
| 35 ExecutionContext*, |
33 std::unique_ptr<SensorReadingFactory>); | 36 std::unique_ptr<SensorReadingFactory>); |
34 | 37 |
35 SensorProxy* getSensor(device::mojom::blink::SensorType); | 38 SensorProxy* getSensor(device::mojom::blink::SensorType); |
36 | 39 |
37 DECLARE_VIRTUAL_TRACE(); | 40 DECLARE_VIRTUAL_TRACE(); |
38 | 41 |
39 private: | 42 private: |
40 friend class SensorProxy; // To call sensorProvider(). | 43 friend class SensorProxy; // To call sensorProvider(). |
41 | 44 |
42 explicit SensorProviderProxy(LocalFrame*); | 45 explicit SensorProviderProxy(LocalFrame*); |
43 static const char* supplementName(); | 46 static const char* supplementName(); |
44 | 47 |
45 device::mojom::blink::SensorProvider* sensorProvider() const { | 48 device::mojom::blink::SensorProvider* sensorProvider() const { |
46 return m_sensorProvider.get(); | 49 return m_sensorProvider.get(); |
47 } | 50 } |
48 | 51 |
49 void onSensorProviderConnectionError(); | 52 void onSensorProviderConnectionError(); |
| 53 void onPermissionServiceConnectionError(); |
50 | 54 |
51 using SensorsSet = HeapHashSet<WeakMember<SensorProxy>>; | 55 using SensorsSet = HeapHashSet<WeakMember<SensorProxy>>; |
52 SensorsSet m_sensors; | 56 SensorsSet m_sensors; |
53 | 57 |
54 device::mojom::blink::SensorProviderPtr m_sensorProvider; | 58 device::mojom::blink::SensorProviderPtr m_sensorProvider; |
| 59 mojom::blink::PermissionServicePtr m_permissionService; |
55 }; | 60 }; |
56 | 61 |
57 } // namespace blink | 62 } // namespace blink |
58 | 63 |
59 #endif // SensorProviderProxy_h | 64 #endif // SensorProviderProxy_h |
OLD | NEW |