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

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: 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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(UMARequestDeviceOutcome::NO_BLUETOOTH_ADAPTER);
339 callback.Run(blink::mojom::WebBluetoothError::NO_BLUETOOTH_ADAPTER, 339 callback.Run(blink::mojom::WebBluetoothError::NO_BLUETOOTH_ADAPTER,
340 nullptr /* device */); 340 nullptr /* device */);
341 return; 341 return;
342 } 342 }
343 if (!BluetoothAdapterFactoryWrapper::Get().IsLowEnergyAvailable()) {
ortuno 2016/10/04 03:20:24 Replace BluetoothAdapterFactoryWrapper::Get().IsBl
François Beaufort 2016/10/04 10:00:22 Done.
344 RecordRequestDeviceOutcome(
345 UMARequestDeviceOutcome::BLUETOOTH_LOW_ENERGY_NOT_AVAILABLE);
ortuno 2016/10/04 03:20:24 Use this errors rather than the NO_BLUETOOTH_ADAPT
François Beaufort 2016/10/04 10:00:22 Done.
346 callback.Run(
347 blink::mojom::WebBluetoothError::BLUETOOTH_LOW_ENERGY_NOT_AVAILABLE,
348 nullptr /* device */);
349 return;
350 }
343 RequestDeviceImpl(std::move(options), callback, GetAdapter()); 351 RequestDeviceImpl(std::move(options), callback, GetAdapter());
344 } 352 }
345 353
346 void WebBluetoothServiceImpl::RemoteServerConnect( 354 void WebBluetoothServiceImpl::RemoteServerConnect(
347 const WebBluetoothDeviceId& device_id, 355 const WebBluetoothDeviceId& device_id,
348 const RemoteServerConnectCallback& callback) { 356 const RemoteServerConnectCallback& callback) {
349 DCHECK_CURRENTLY_ON(BrowserThread::UI); 357 DCHECK_CURRENTLY_ON(BrowserThread::UI);
350 RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::CONNECT_GATT); 358 RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::CONNECT_GATT);
351 359
352 const CacheQueryResult query_result = QueryCacheForDevice(device_id); 360 const CacheQueryResult query_result = QueryCacheForDevice(device_id);
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 characteristic_id_to_service_id_.clear(); 1009 characteristic_id_to_service_id_.clear();
1002 service_id_to_device_address_.clear(); 1010 service_id_to_device_address_.clear();
1003 connected_devices_.reset( 1011 connected_devices_.reset(
1004 new FrameConnectedBluetoothDevices(render_frame_host_)); 1012 new FrameConnectedBluetoothDevices(render_frame_host_));
1005 allowed_devices_map_ = BluetoothAllowedDevicesMap(); 1013 allowed_devices_map_ = BluetoothAllowedDevicesMap();
1006 device_chooser_controller_.reset(); 1014 device_chooser_controller_.reset();
1007 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this); 1015 BluetoothAdapterFactoryWrapper::Get().ReleaseAdapter(this);
1008 } 1016 }
1009 1017
1010 } // namespace content 1018 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698