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" |
(...skipping 25 matching lines...) Expand all Loading... |
36 | 36 |
37 SensorProxy* getSensorProxy(device::mojom::blink::SensorType); | 37 SensorProxy* getSensorProxy(device::mojom::blink::SensorType); |
38 | 38 |
39 DECLARE_VIRTUAL_TRACE(); | 39 DECLARE_VIRTUAL_TRACE(); |
40 | 40 |
41 private: | 41 private: |
42 friend class SensorProxy; // To call sensorProvider(). | 42 friend class SensorProxy; // To call sensorProvider(). |
43 | 43 |
44 explicit SensorProviderProxy(LocalFrame*); | 44 explicit SensorProviderProxy(LocalFrame*); |
45 static const char* supplementName(); | 45 static const char* supplementName(); |
| 46 void initializeSensorProviderIfNeeded(LocalFrame*); |
46 | 47 |
47 device::mojom::blink::SensorProvider* sensorProvider() const { | 48 device::mojom::blink::SensorProvider* getSensorProvider() const; |
48 return m_sensorProvider.get(); | |
49 } | |
50 | 49 |
51 void onSensorProviderConnectionError(); | 50 void onSensorProviderConnectionError(); |
52 | 51 |
53 using SensorsSet = HeapHashSet<WeakMember<SensorProxy>>; | 52 using SensorsSet = HeapHashSet<WeakMember<SensorProxy>>; |
54 SensorsSet m_sensorProxies; | 53 SensorsSet m_sensorProxies; |
55 | 54 |
56 device::mojom::blink::SensorProviderPtr m_sensorProvider; | 55 device::mojom::blink::SensorProviderPtr m_sensorProvider; |
57 }; | 56 }; |
58 | 57 |
59 } // namespace blink | 58 } // namespace blink |
60 | 59 |
61 #endif // SensorProviderProxy_h | 60 #endif // SensorProviderProxy_h |
OLD | NEW |