1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
// Copyright 2014 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 CONTENT_CHILD_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_
#define CONTENT_CHILD_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_
#include <stdint.h>
#include <string>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "content/common/content_export.h"
#include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h"
namespace blink {
class WebBluetoothRemoteGATTCharacteristic;
}
namespace content {
class BluetoothDispatcher;
class ThreadSafeSender;
// Implementation of blink::WebBluetooth. Passes calls through to the thread
// specific BluetoothDispatcher.
class CONTENT_EXPORT WebBluetoothImpl
: NON_EXPORTED_BASE(public blink::WebBluetooth) {
public:
explicit WebBluetoothImpl(ThreadSafeSender* thread_safe_sender);
WebBluetoothImpl(ThreadSafeSender* thread_safe_sender, int frame_routing_id);
~WebBluetoothImpl() override;
// blink::WebBluetooth interface:
void requestDevice(
const blink::WebRequestDeviceOptions& options,
blink::WebBluetoothRequestDeviceCallbacks* callbacks) override;
void connect(
const blink::WebString& device_id,
blink::WebBluetoothRemoteGATTServerConnectCallbacks* callbacks) override;
void disconnect(const blink::WebString& device_id) override;
void getPrimaryService(
const blink::WebString& device_id,
const blink::WebString& service_uuid,
blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks) override;
void getCharacteristic(
const blink::WebString& service_instance_id,
const blink::WebString& characteristic_uuid,
blink::WebBluetoothGetCharacteristicCallbacks* callbacks) override;
void getCharacteristics(
const blink::WebString& service_instance_id,
const blink::WebString& characteristics_uuid,
blink::WebBluetoothGetCharacteristicsCallbacks* callbacks) override;
void readValue(const blink::WebString& characteristic_instance_id,
blink::WebBluetoothReadValueCallbacks* callbacks) override;
void writeValue(const blink::WebString& characteristic_instance_id,
const blink::WebVector<uint8_t>& value,
blink::WebBluetoothWriteValueCallbacks*) override;
void startNotifications(
const blink::WebString& characteristic_instance_id,
blink::WebBluetoothRemoteGATTCharacteristic* characteristic,
blink::WebBluetoothNotificationsCallbacks*) override;
void stopNotifications(
const blink::WebString& characteristic_instance_id,
blink::WebBluetoothRemoteGATTCharacteristic* characteristic,
blink::WebBluetoothNotificationsCallbacks*) override;
void characteristicObjectRemoved(
const blink::WebString& characteristic_instance_id,
blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override;
void registerCharacteristicObject(
const blink::WebString& characteristic_instance_id,
blink::WebBluetoothRemoteGATTCharacteristic* characteristic) override;
private:
BluetoothDispatcher* GetDispatcher();
const scoped_refptr<ThreadSafeSender> thread_safe_sender_;
const int frame_routing_id_;
DISALLOW_COPY_AND_ASSIGN(WebBluetoothImpl);
};
} // namespace content
#endif // CONTENT_CHILD_BLUETOOTH_WEB_BLUETOOTH_IMPL_H_
|