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

Side by Side Diff: content/child/bluetooth/bluetooth_dispatcher.h

Issue 1156573005: bluetooth: Browser-side implementation of getCharacteristic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-get-primary-service-initial
Patch Set: Fix histograms.xml and bad_messages.h merge conflict Created 5 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ 5 #ifndef CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_
6 #define CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ 6 #define CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_
7 7
8 #include "base/id_map.h" 8 #include "base/id_map.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "content/child/worker_task_runner.h" 10 #include "content/child/worker_task_runner.h"
11 #include "content/common/bluetooth/bluetooth_device.h" 11 #include "content/common/bluetooth/bluetooth_device.h"
12 #include "content/common/bluetooth/bluetooth_error.h" 12 #include "content/common/bluetooth/bluetooth_error.h"
13 #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h" 13 #include "third_party/WebKit/public/platform/modules/bluetooth/WebBluetooth.h"
14 14
15 namespace base { 15 namespace base {
16 class MessageLoop; 16 class MessageLoop;
17 class TaskRunner; 17 class TaskRunner;
18 } 18 }
19 19
20 namespace IPC { 20 namespace IPC {
21 class Message; 21 class Message;
22 } 22 }
23 23
24 struct BluetoothCharacteristicRequest;
24 struct BluetoothPrimaryServiceRequest; 25 struct BluetoothPrimaryServiceRequest;
25 26
26 namespace content { 27 namespace content {
27 class ThreadSafeSender; 28 class ThreadSafeSender;
28 29
29 // Dispatcher for child process threads which communicates to the browser's 30 // Dispatcher for child process threads which communicates to the browser's
30 // BluetoothDispatcherHost. 31 // BluetoothDispatcherHost.
31 // 32 //
32 // Instances are created for each thread as necessary by WebBluetoothImpl. 33 // Instances are created for each thread as necessary by WebBluetoothImpl.
33 // 34 //
(...skipping 16 matching lines...) Expand all
50 51
51 // Corresponding to WebBluetoothImpl methods. 52 // Corresponding to WebBluetoothImpl methods.
52 void requestDevice(blink::WebBluetoothRequestDeviceCallbacks* callbacks); 53 void requestDevice(blink::WebBluetoothRequestDeviceCallbacks* callbacks);
53 void connectGATT(const blink::WebString& device_instance_id, 54 void connectGATT(const blink::WebString& device_instance_id,
54 blink::WebBluetoothConnectGATTCallbacks* callbacks); 55 blink::WebBluetoothConnectGATTCallbacks* callbacks);
55 void getPrimaryService( 56 void getPrimaryService(
56 const blink::WebString& device_instance_id, 57 const blink::WebString& device_instance_id,
57 const blink::WebString& service_uuid, 58 const blink::WebString& service_uuid,
58 blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks); 59 blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks);
59 60
61 void getCharacteristic(
62 const blink::WebString& service_instance_id,
63 const blink::WebString& characteristic_uuid,
64 blink::WebBluetoothGetCharacteristicCallbacks* callbacks);
65
60 // WorkerTaskRunner::Observer implementation. 66 // WorkerTaskRunner::Observer implementation.
61 void OnWorkerRunLoopStopped() override; 67 void OnWorkerRunLoopStopped() override;
62 68
63 private: 69 private:
64 // IPC Handlers, see definitions in bluetooth_messages.h. 70 // IPC Handlers, see definitions in bluetooth_messages.h.
65 void OnRequestDeviceSuccess(int thread_id, 71 void OnRequestDeviceSuccess(int thread_id,
66 int request_id, 72 int request_id,
67 const BluetoothDevice& device); 73 const BluetoothDevice& device);
68 void OnRequestDeviceError(int thread_id, 74 void OnRequestDeviceError(int thread_id,
69 int request_id, 75 int request_id,
70 BluetoothError error_type); 76 BluetoothError error_type);
71 77
72 void OnConnectGATTSuccess(int thread_id, 78 void OnConnectGATTSuccess(int thread_id,
73 int request_id, 79 int request_id,
74 const std::string& message); 80 const std::string& message);
75 81
76 void OnConnectGATTError(int thread_id, 82 void OnConnectGATTError(int thread_id,
77 int request_id, 83 int request_id,
78 BluetoothError error_type); 84 BluetoothError error_type);
79 void OnGetPrimaryServiceSuccess(int thread_id, 85 void OnGetPrimaryServiceSuccess(int thread_id,
80 int request_id, 86 int request_id,
81 const std::string& service_instance_id); 87 const std::string& service_instance_id);
82 void OnGetPrimaryServiceError(int thread_id, 88 void OnGetPrimaryServiceError(int thread_id,
83 int request_id, 89 int request_id,
84 BluetoothError error_type); 90 BluetoothError error_type);
91 void OnGetCharacteristicSuccess(
92 int thread_id,
93 int request_id,
94 const std::string& characteristic_instance_id);
95 void OnGetCharacteristicError(int thread_id,
96 int request_id,
97 BluetoothError error_type);
85 98
86 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 99 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
87 100
88 // Tracks device requests sent to browser to match replies with callbacks. 101 // Tracks device requests sent to browser to match replies with callbacks.
89 // Owns callback objects. 102 // Owns callback objects.
90 IDMap<blink::WebBluetoothRequestDeviceCallbacks, IDMapOwnPointer> 103 IDMap<blink::WebBluetoothRequestDeviceCallbacks, IDMapOwnPointer>
91 pending_requests_; 104 pending_requests_;
92 // Tracks requests to connect to a device. 105 // Tracks requests to connect to a device.
93 // Owns callback objects. 106 // Owns callback objects.
94 IDMap<blink::WebBluetoothConnectGATTCallbacks, IDMapOwnPointer> 107 IDMap<blink::WebBluetoothConnectGATTCallbacks, IDMapOwnPointer>
95 pending_connect_requests_; 108 pending_connect_requests_;
96 // Tracks requests to get a primary service from a device. 109 // Tracks requests to get a primary service from a device.
97 // Owns request objects. 110 // Owns request objects.
98 IDMap<BluetoothPrimaryServiceRequest, IDMapOwnPointer> 111 IDMap<BluetoothPrimaryServiceRequest, IDMapOwnPointer>
99 pending_primary_service_requests_; 112 pending_primary_service_requests_;
113 // Tracks requests to get a characteristic from a service.
114 IDMap<BluetoothCharacteristicRequest, IDMapOwnPointer>
115 pending_characteristic_requests_;
100 116
101 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher); 117 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher);
102 }; 118 };
103 119
104 } // namespace content 120 } // namespace content
105 121
106 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ 122 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/browser/bluetooth/bluetooth_dispatcher_host.cc ('k') | content/child/bluetooth/bluetooth_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698