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

Side by Side Diff: content/browser/bluetooth/web_bluetooth_service_impl.cc

Issue 2384463002: bluetooth: mac: Reject requestDevice promise if Mac version is <= 10.9 (Closed)
Patch Set: Rebase Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 // ID Not In Map Note: 5 // ID Not In Map Note:
6 // A service, characteristic, or descriptor ID not in the corresponding 6 // A service, characteristic, or descriptor ID not in the corresponding
7 // WebBluetoothServiceImpl map [service_id_to_device_address_, 7 // WebBluetoothServiceImpl map [service_id_to_device_address_,
8 // characteristic_id_to_service_id_, descriptor_to_characteristic_] implies a 8 // characteristic_id_to_service_id_, descriptor_to_characteristic_] implies a
9 // hostile renderer because a renderer obtains the corresponding ID from this 9 // hostile renderer because a renderer obtains the corresponding ID from this
10 // class and it will be added to the map at that time. 10 // class and it will be added to the map at that time.
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 client_.Bind(std::move(client)); 321 client_.Bind(std::move(client));
322 } 322 }
323 323
324 void WebBluetoothServiceImpl::RequestDevice( 324 void WebBluetoothServiceImpl::RequestDevice(
325 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options, 325 blink::mojom::WebBluetoothRequestDeviceOptionsPtr options,
326 const RequestDeviceCallback& callback) { 326 const RequestDeviceCallback& callback) {
327 RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::REQUEST_DEVICE); 327 RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::REQUEST_DEVICE);
328 RecordRequestDeviceOptions(options); 328 RecordRequestDeviceOptions(options);
329 329
330 if (!GetAdapter()) { 330 if (!GetAdapter()) {
331 if (BluetoothAdapterFactoryWrapper::Get().IsBluetoothAdapterAvailable()) { 331 if (BluetoothAdapterFactoryWrapper::Get().IsLowEnergyAvailable()) {
332 BluetoothAdapterFactoryWrapper::Get().AcquireAdapter( 332 BluetoothAdapterFactoryWrapper::Get().AcquireAdapter(
333 this, base::Bind(&WebBluetoothServiceImpl::RequestDeviceImpl, 333 this, base::Bind(&WebBluetoothServiceImpl::RequestDeviceImpl,
334 weak_ptr_factory_.GetWeakPtr(), 334 weak_ptr_factory_.GetWeakPtr(),
335 base::Passed(std::move(options)), callback)); 335 base::Passed(std::move(options)), callback));
336 return; 336 return;
337 } 337 }
338 RecordRequestDeviceOutcome(UMARequestDeviceOutcome::NO_BLUETOOTH_ADAPTER); 338 RecordRequestDeviceOutcome(
339 callback.Run(blink::mojom::WebBluetoothError::NO_BLUETOOTH_ADAPTER, 339 UMARequestDeviceOutcome::BLUETOOTH_LOW_ENERGY_NOT_AVAILABLE);
340 nullptr /* device */); 340 callback.Run(
341 blink::mojom::WebBluetoothError::BLUETOOTH_LOW_ENERGY_NOT_AVAILABLE,
342 nullptr /* device */);
341 return; 343 return;
342 } 344 }
343 RequestDeviceImpl(std::move(options), callback, GetAdapter()); 345 RequestDeviceImpl(std::move(options), callback, GetAdapter());
344 } 346 }
345 347
346 void WebBluetoothServiceImpl::RemoteServerConnect( 348 void WebBluetoothServiceImpl::RemoteServerConnect(
347 const WebBluetoothDeviceId& device_id, 349 const WebBluetoothDeviceId& device_id,
348 const RemoteServerConnectCallback& callback) { 350 const RemoteServerConnectCallback& callback) {
349 DCHECK_CURRENTLY_ON(BrowserThread::UI); 351 DCHECK_CURRENTLY_ON(BrowserThread::UI);
350 RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::CONNECT_GATT); 352 RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::CONNECT_GATT);
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 characteristic_id_to_service_id_.clear(); 1003 characteristic_id_to_service_id_.clear();
1002 service_id_to_device_address_.clear(); 1004 service_id_to_device_address_.clear();
1003 connected_devices_.reset( 1005 connected_devices_.reset(
1004 new FrameConnectedBluetoothDevices(render_frame_host_)); 1006 new FrameConnectedBluetoothDevices(render_frame_host_));
1005 allowed_devices_map_ = BluetoothAllowedDevicesMap(); 1007 allowed_devices_map_ = BluetoothAllowedDevicesMap();
1006 device_chooser_controller_.reset(); 1008 device_chooser_controller_.reset();
1007 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this); 1009 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this);
1008 } 1010 }
1009 1011
1010 } // namespace content 1012 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/bluetooth/bluetooth_metrics.h ('k') | device/bluetooth/bluetooth_adapter_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698