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