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

Side by Side Diff: content/renderer/bluetooth/bluetooth_dispatcher.cc

Issue 1945823003: bluetooth: Remove BluetoothAdvertisementData (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@my-origin
Patch Set: Fix test Created 4 years, 7 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 #include "content/renderer/bluetooth/bluetooth_dispatcher.h" 5 #include "content/renderer/bluetooth/bluetooth_dispatcher.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 int request_id, 143 int request_id,
144 const BluetoothDevice& device) { 144 const BluetoothDevice& device) {
145 DCHECK(pending_requests_.Lookup(request_id)) << request_id; 145 DCHECK(pending_requests_.Lookup(request_id)) << request_id;
146 146
147 WebVector<WebString> uuids(device.uuids.size()); 147 WebVector<WebString> uuids(device.uuids.size());
148 for (size_t i = 0; i < device.uuids.size(); ++i) 148 for (size_t i = 0; i < device.uuids.size(); ++i)
149 uuids[i] = WebString::fromUTF8(device.uuids[i].c_str()); 149 uuids[i] = WebString::fromUTF8(device.uuids[i].c_str());
150 150
151 pending_requests_.Lookup(request_id) 151 pending_requests_.Lookup(request_id)
152 ->onSuccess(base::WrapUnique(new WebBluetoothDevice( 152 ->onSuccess(base::WrapUnique(new WebBluetoothDevice(
153 WebString::fromUTF8(device.id), WebString(device.name), 153 WebString::fromUTF8(device.id), WebString(device.name), uuids)));
154 device.tx_power, device.rssi, uuids)));
155 pending_requests_.Remove(request_id); 154 pending_requests_.Remove(request_id);
156 } 155 }
157 156
158 void BluetoothDispatcher::OnRequestDeviceError(int thread_id, 157 void BluetoothDispatcher::OnRequestDeviceError(int thread_id,
159 int request_id, 158 int request_id,
160 WebBluetoothError error) { 159 WebBluetoothError error) {
161 DCHECK(pending_requests_.Lookup(request_id)) << request_id; 160 DCHECK(pending_requests_.Lookup(request_id)) << request_id;
162 pending_requests_.Lookup(request_id)->onError(WebBluetoothError(error)); 161 pending_requests_.Lookup(request_id)->onError(WebBluetoothError(error));
163 pending_requests_.Remove(request_id); 162 pending_requests_.Remove(request_id);
164 } 163 }
165 164
166 void BluetoothDispatcher::OnGATTServerConnectSuccess(int thread_id, 165 void BluetoothDispatcher::OnGATTServerConnectSuccess(int thread_id,
167 int request_id) { 166 int request_id) {
168 DCHECK(pending_connect_requests_.Lookup(request_id)) << request_id; 167 DCHECK(pending_connect_requests_.Lookup(request_id)) << request_id;
169 pending_connect_requests_.Lookup(request_id)->onSuccess(); 168 pending_connect_requests_.Lookup(request_id)->onSuccess();
170 pending_connect_requests_.Remove(request_id); 169 pending_connect_requests_.Remove(request_id);
171 } 170 }
172 171
173 void BluetoothDispatcher::OnGATTServerConnectError(int thread_id, 172 void BluetoothDispatcher::OnGATTServerConnectError(int thread_id,
174 int request_id, 173 int request_id,
175 WebBluetoothError error) { 174 WebBluetoothError error) {
176 DCHECK(pending_connect_requests_.Lookup(request_id)) << request_id; 175 DCHECK(pending_connect_requests_.Lookup(request_id)) << request_id;
177 pending_connect_requests_.Lookup(request_id) 176 pending_connect_requests_.Lookup(request_id)
178 ->onError(WebBluetoothError(error)); 177 ->onError(WebBluetoothError(error));
179 pending_connect_requests_.Remove(request_id); 178 pending_connect_requests_.Remove(request_id);
180 } 179 }
181 180
182 } // namespace content 181 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698