Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(221)

Unified Diff: third_party/WebKit/Source/modules/sensor/SensorProviderProxy.h

Issue 2121313002: [sensors] Generic Sensors Framework blink side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@sensors_mojo_interfaces
Patch Set: build fix for win Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « third_party/WebKit/Source/modules/sensor/OWNERS ('k') | third_party/WebKit/Source/modules/sensor/SensorProviderProxy.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698