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

Unified Diff: Source/modules/bluetooth/BluetoothSupplement.h

Issue 1228283003: Attach a WebBluetooth to the LocalFrame and use it if it's available. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@error-enum-cleanup
Patch Set: Always use BluetoothSupplement to get the WebBluetooth instance. Created 5 years, 5 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
« no previous file with comments | « Source/modules/bluetooth/BluetoothGATTService.cpp ('k') | Source/modules/bluetooth/BluetoothSupplement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/bluetooth/BluetoothSupplement.h
diff --git a/Source/modules/bluetooth/BluetoothSupplement.h b/Source/modules/bluetooth/BluetoothSupplement.h
new file mode 100644
index 0000000000000000000000000000000000000000..5b35c2e5052802ab599f0aafa05e641181da8f1c
--- /dev/null
+++ b/Source/modules/bluetooth/BluetoothSupplement.h
@@ -0,0 +1,40 @@
+// Copyright 2015 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 BluetoothSupplement_h
+#define BluetoothSupplement_h
+
+#include "core/frame/LocalFrame.h"
+
+namespace blink {
+
+class WebBluetooth;
+
+// This class is attached to a LocalFrame in WebLocalFrameImpl::setCoreFrame, to
+// pass WebFrameClient::bluetooth() (accessible by web/ only) to the Bluetooth
+// code in modules/.
+class BLINK_EXPORT BluetoothSupplement : public NoBaseWillBeGarbageCollected<BluetoothSupplement>, public WillBeHeapSupplement<LocalFrame> {
+ WTF_MAKE_NONCOPYABLE(BluetoothSupplement);
+ WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(BluetoothSupplement);
+
+public:
+ static const char* supplementName();
+
+ static void provideTo(LocalFrame&, WebBluetooth*);
+
+ // Returns the WebBluetooth attached to the ScriptState's frame if that exists;
+ // otherwise the Platform's WebBluetooth.
+ static WebBluetooth* from(ScriptState*);
+
+ DECLARE_VIRTUAL_TRACE();
+
+private:
+ explicit BluetoothSupplement(WebBluetooth*);
+
+ WebBluetooth* m_bluetooth;
+};
+
+} // namespace blink
+
+#endif // BluetoothRoutingId_h
« no previous file with comments | « Source/modules/bluetooth/BluetoothGATTService.cpp ('k') | Source/modules/bluetooth/BluetoothSupplement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698