Upstreaming browser/ui/uikit_ui_util from iOS.
[chromium-blink-merge.git] / content / renderer / bluetooth / web_bluetooth_impl.h
blob8ddbbeec69bea0d93356f00eb9cdacee3d9efdc8
1 // Copyright 2014 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.
5 #ifndef CONTENT_CHILD_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_
6 #define CONTENT_CHILD_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_
8 #include <string>
10 #include "base/compiler_specific.h"
11 #include "base/memory/ref_counted.h"
12 #include "content/common/content_export.h"
13 #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h"
15 namespace content {
17 class BluetoothDispatcher;
18 class ThreadSafeSender;
20 // Implementation of blink::WebBluetooth. Passes calls through to the thread
21 // specific BluetoothDispatcher.
22 class CONTENT_EXPORT WebBluetoothImpl
23 : NON_EXPORTED_BASE(public blink::WebBluetooth) {
24 public:
25 explicit WebBluetoothImpl(ThreadSafeSender* thread_safe_sender);
26 WebBluetoothImpl(ThreadSafeSender* thread_safe_sender, int frame_routing_id);
27 ~WebBluetoothImpl();
29 // blink::WebBluetooth interface:
30 void requestDevice(
31 const blink::WebRequestDeviceOptions& options,
32 blink::WebBluetoothRequestDeviceCallbacks* callbacks) override;
33 void connectGATT(const blink::WebString& device_instance_id,
34 blink::WebBluetoothConnectGATTCallbacks* callbacks) override;
35 void getPrimaryService(
36 const blink::WebString& device_instance_id,
37 const blink::WebString& service_uuid,
38 blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks) override;
39 void getCharacteristic(
40 const blink::WebString& service_instance_id,
41 const blink::WebString& characteristic_uuid,
42 blink::WebBluetoothGetCharacteristicCallbacks* callbacks) override;
43 void readValue(const blink::WebString& characteristic_instance_id,
44 blink::WebBluetoothReadValueCallbacks* callbacks) override;
45 void writeValue(const blink::WebString& characteristic_instance_id,
46 const std::vector<uint8_t>& value,
47 blink::WebBluetoothWriteValueCallbacks*) override;
49 private:
50 BluetoothDispatcher* GetDispatcher();
52 const scoped_refptr<ThreadSafeSender> thread_safe_sender_;
53 const int frame_routing_id_;
55 DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl);
58 } // namespace content
60 #endif // CONTENT_CHILD_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_