OLD | NEW |
| (Empty) |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef BluetoothSupplement_h | |
6 #define BluetoothSupplement_h | |
7 | |
8 #include "core/frame/LocalFrame.h" | |
9 | |
10 namespace blink { | |
11 | |
12 class WebBluetooth; | |
13 | |
14 // This class is attached to a LocalFrame in WebLocalFrameImpl::setCoreFrame, to | |
15 // pass WebFrameClient::bluetooth() (accessible by web/ only) to the Bluetooth | |
16 // code in modules/. | |
17 class BLINK_EXPORT BluetoothSupplement | |
18 : public GarbageCollected<BluetoothSupplement>, | |
19 public Supplement<LocalFrame> { | |
20 WTF_MAKE_NONCOPYABLE(BluetoothSupplement); | |
21 USING_GARBAGE_COLLECTED_MIXIN(BluetoothSupplement); | |
22 | |
23 public: | |
24 static const char* supplementName(); | |
25 | |
26 static void provideTo(LocalFrame&, WebBluetooth*); | |
27 | |
28 // Returns the WebBluetooth attached to the frame. | |
29 static WebBluetooth* from(LocalFrame*); | |
30 | |
31 // Returns the WebBluetooth attached to the frame if the frame exists. | |
32 // Otherwise returns nullptr. | |
33 static WebBluetooth* fromScriptState(ScriptState*); | |
34 // Returns the WebBluetooth attached to the execution context. | |
35 static WebBluetooth* fromExecutionContext(ExecutionContext*); | |
36 | |
37 DECLARE_VIRTUAL_TRACE(); | |
38 | |
39 private: | |
40 explicit BluetoothSupplement(WebBluetooth*); | |
41 | |
42 WebBluetooth* m_bluetooth; | |
43 }; | |
44 | |
45 } // namespace blink | |
46 | |
47 #endif // BluetoothRoutingId_h | |
OLD | NEW |