| Index: third_party/WebKit/Source/modules/sensor/SensorProviderProxy.h
|
| diff --git a/third_party/WebKit/Source/modules/sensor/SensorProviderProxy.h b/third_party/WebKit/Source/modules/sensor/SensorProviderProxy.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fd0bce93bdfb244240ed1fdf7221111be5357712
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/modules/sensor/SensorProviderProxy.h
|
| @@ -0,0 +1,52 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef SensorProviderProxy_h
|
| +#define SensorProviderProxy_h
|
| +
|
| +#include "core/frame/LocalFrame.h"
|
| +#include "device/generic_sensor/public/interfaces/sensor.mojom-blink.h"
|
| +#include "device/generic_sensor/public/interfaces/sensor_provider.mojom-blink.h"
|
| +#include "platform/Supplementable.h"
|
| +#include "platform/heap/Handle.h"
|
| +
|
| +namespace blink {
|
| +
|
| +class SensorProxy;
|
| +
|
| +// This class wraps 'SensorProvider' mojo interface and it manages
|
| +// 'SensorProxy' instances.
|
| +class SensorProviderProxy final
|
| + : public GarbageCollectedFinalized<SensorProviderProxy>
|
| + , public Supplement<LocalFrame> {
|
| + USING_GARBAGE_COLLECTED_MIXIN(SensorProviderProxy);
|
| + WTF_MAKE_NONCOPYABLE(SensorProviderProxy);
|
| +public:
|
| + static SensorProviderProxy* from(LocalFrame*);
|
| +
|
| + ~SensorProviderProxy();
|
| +
|
| + SensorProxy* getOrCreateSensor(device::mojom::blink::SensorType);
|
| +
|
| + DECLARE_VIRTUAL_TRACE();
|
| +
|
| +private:
|
| + friend class SensorProxy; // To call sensorProvider().
|
| +
|
| + explicit SensorProviderProxy(LocalFrame*);
|
| + static const char* supplementName();
|
| +
|
| + device::mojom::blink::SensorProvider* sensorProvider() const { return m_sensorProvider.get(); }
|
| +
|
| + void onSensorProviderConnectionError();
|
| +
|
| + using SensorsSet = HeapHashSet<WeakMember<SensorProxy>>;
|
| + SensorsSet m_sensors;
|
| +
|
| + device::mojom::blink::SensorProviderPtr m_sensorProvider;
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // SensorProviderProxy_h
|
|
|