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

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

Issue 1217983004: bluetooth: browser-side implementation of writeValue. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bluetooth-origin
Patch Set: Use the vector passed instead of creating a new copy in the browser. 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 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"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 const blink::WebString& device_instance_id, 58 const blink::WebString& device_instance_id,
59 const blink::WebString& service_uuid, 59 const blink::WebString& service_uuid,
60 blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks); 60 blink::WebBluetoothGetPrimaryServiceCallbacks* callbacks);
61 61
62 void getCharacteristic( 62 void getCharacteristic(
63 const blink::WebString& service_instance_id, 63 const blink::WebString& service_instance_id,
64 const blink::WebString& characteristic_uuid, 64 const blink::WebString& characteristic_uuid,
65 blink::WebBluetoothGetCharacteristicCallbacks* callbacks); 65 blink::WebBluetoothGetCharacteristicCallbacks* callbacks);
66 void readValue(const blink::WebString& characteristic_instance_id, 66 void readValue(const blink::WebString& characteristic_instance_id,
67 blink::WebBluetoothReadValueCallbacks* callbacks); 67 blink::WebBluetoothReadValueCallbacks* callbacks);
68 void writeValue(const blink::WebString& characteristic_instance_id,
69 const std::vector<uint8_t>& value,
70 blink::WebBluetoothWriteValueCallbacks*);
68 71
69 // WorkerTaskRunner::Observer implementation. 72 // WorkerTaskRunner::Observer implementation.
70 void OnWorkerRunLoopStopped() override; 73 void OnWorkerRunLoopStopped() override;
71 74
72 private: 75 private:
73 // IPC Handlers, see definitions in bluetooth_messages.h. 76 // IPC Handlers, see definitions in bluetooth_messages.h.
74 void OnRequestDeviceSuccess(int thread_id, 77 void OnRequestDeviceSuccess(int thread_id,
75 int request_id, 78 int request_id,
76 const BluetoothDevice& device); 79 const BluetoothDevice& device);
77 void OnRequestDeviceError(int thread_id, 80 void OnRequestDeviceError(int thread_id,
(...skipping 24 matching lines...) Expand all
102 int request_id, 105 int request_id,
103 BluetoothError error_type, 106 BluetoothError error_type,
104 const std::string& error_message); 107 const std::string& error_message);
105 void OnReadValueSuccess(int thread_id, 108 void OnReadValueSuccess(int thread_id,
106 int request_id, 109 int request_id,
107 const std::vector<uint8_t>& value); 110 const std::vector<uint8_t>& value);
108 void OnReadValueError(int thread_id, 111 void OnReadValueError(int thread_id,
109 int request_id, 112 int request_id,
110 BluetoothError error_type, 113 BluetoothError error_type,
111 const std::string& error_message); 114 const std::string& error_message);
115 void OnWriteValueSuccess(int thread_id, int request_id);
116 void OnWriteValueError(int thread_id,
117 int request_id,
118 BluetoothError error_type,
119 const std::string& error_message);
112 120
113 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 121 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
114 122
115 // Tracks device requests sent to browser to match replies with callbacks. 123 // Tracks device requests sent to browser to match replies with callbacks.
116 // Owns callback objects. 124 // Owns callback objects.
117 IDMap<blink::WebBluetoothRequestDeviceCallbacks, IDMapOwnPointer> 125 IDMap<blink::WebBluetoothRequestDeviceCallbacks, IDMapOwnPointer>
118 pending_requests_; 126 pending_requests_;
119 // Tracks requests to connect to a device. 127 // Tracks requests to connect to a device.
120 // Owns callback objects. 128 // Owns callback objects.
121 IDMap<blink::WebBluetoothConnectGATTCallbacks, IDMapOwnPointer> 129 IDMap<blink::WebBluetoothConnectGATTCallbacks, IDMapOwnPointer>
122 pending_connect_requests_; 130 pending_connect_requests_;
123 // Tracks requests to get a primary service from a device. 131 // Tracks requests to get a primary service from a device.
124 // Owns request objects. 132 // Owns request objects.
125 IDMap<BluetoothPrimaryServiceRequest, IDMapOwnPointer> 133 IDMap<BluetoothPrimaryServiceRequest, IDMapOwnPointer>
126 pending_primary_service_requests_; 134 pending_primary_service_requests_;
127 // Tracks requests to get a characteristic from a service. 135 // Tracks requests to get a characteristic from a service.
128 IDMap<BluetoothCharacteristicRequest, IDMapOwnPointer> 136 IDMap<BluetoothCharacteristicRequest, IDMapOwnPointer>
129 pending_characteristic_requests_; 137 pending_characteristic_requests_;
130 // Tracks requests to read from a characteristics. 138 // Tracks requests to read from a characteristics.
131 IDMap<blink::WebBluetoothReadValueCallbacks, IDMapOwnPointer> 139 IDMap<blink::WebBluetoothReadValueCallbacks, IDMapOwnPointer>
132 pending_read_value_requests_; 140 pending_read_value_requests_;
141 IDMap<blink::WebBluetoothWriteValueCallbacks, IDMapOwnPointer>
142 pending_write_value_requests_;
133 143
134 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher); 144 DISALLOW_COPY_AND_ASSIGN(BluetoothDispatcher);
135 }; 145 };
136 146
137 } // namespace content 147 } // namespace content
138 148
139 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_ 149 #endif // CONTENT_CHILD_BLUETOOTH_BLUETOOTH_DISPATCHER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698