| OLD | NEW |
| 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 // 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 // BluetoothDispatcherHost map [service_to_device_, characteristic_to_service_, | 7 // BluetoothDispatcherHost map [service_to_device_, characteristic_to_service_, |
| 8 // descriptor_to_characteristic_] implies a hostile renderer because a renderer | 8 // descriptor_to_characteristic_] implies a hostile renderer because a renderer |
| 9 // obtains the corresponding ID from this class and it will be added to the map | 9 // obtains the corresponding ID from this class and it will be added to the map |
| 10 // at that time. | 10 // at that time. |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 } | 640 } |
| 641 | 641 |
| 642 void BluetoothDispatcherHost::OnRequestDevice( | 642 void BluetoothDispatcherHost::OnRequestDevice( |
| 643 int thread_id, | 643 int thread_id, |
| 644 int request_id, | 644 int request_id, |
| 645 int frame_routing_id, | 645 int frame_routing_id, |
| 646 const std::vector<BluetoothScanFilter>& filters, | 646 const std::vector<BluetoothScanFilter>& filters, |
| 647 const std::vector<BluetoothUUID>& optional_services) { | 647 const std::vector<BluetoothUUID>& optional_services) { |
| 648 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 648 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 649 RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::REQUEST_DEVICE); | 649 RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::REQUEST_DEVICE); |
| 650 RecordRequestDeviceArguments(filters, optional_services); |
| 651 |
| 650 if (!adapter_.get()) { | 652 if (!adapter_.get()) { |
| 651 if (BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) { | 653 if (BluetoothAdapterFactory::IsBluetoothAdapterAvailable()) { |
| 652 BluetoothAdapterFactory::GetAdapter(base::Bind( | 654 BluetoothAdapterFactory::GetAdapter(base::Bind( |
| 653 &BluetoothDispatcherHost::OnGetAdapter, weak_ptr_on_ui_thread_, | 655 &BluetoothDispatcherHost::OnGetAdapter, weak_ptr_on_ui_thread_, |
| 654 base::Bind(&BluetoothDispatcherHost::OnRequestDeviceImpl, | 656 base::Bind(&BluetoothDispatcherHost::OnRequestDeviceImpl, |
| 655 weak_ptr_on_ui_thread_, thread_id, request_id, | 657 weak_ptr_on_ui_thread_, thread_id, request_id, |
| 656 frame_routing_id, filters, optional_services))); | 658 frame_routing_id, filters, optional_services))); |
| 657 return; | 659 return; |
| 658 } | 660 } |
| 659 RecordRequestDeviceOutcome(UMARequestDeviceOutcome::NO_BLUETOOTH_ADAPTER); | 661 RecordRequestDeviceOutcome(UMARequestDeviceOutcome::NO_BLUETOOTH_ADAPTER); |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1134 continuation.Run(); | 1136 continuation.Run(); |
| 1135 } | 1137 } |
| 1136 | 1138 |
| 1137 void BluetoothDispatcherHost::OnRequestDeviceImpl( | 1139 void BluetoothDispatcherHost::OnRequestDeviceImpl( |
| 1138 int thread_id, | 1140 int thread_id, |
| 1139 int request_id, | 1141 int request_id, |
| 1140 int frame_routing_id, | 1142 int frame_routing_id, |
| 1141 const std::vector<BluetoothScanFilter>& filters, | 1143 const std::vector<BluetoothScanFilter>& filters, |
| 1142 const std::vector<BluetoothUUID>& optional_services) { | 1144 const std::vector<BluetoothUUID>& optional_services) { |
| 1143 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 1145 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 1144 RecordWebBluetoothFunctionCall(UMAWebBluetoothFunction::REQUEST_DEVICE); | |
| 1145 RecordRequestDeviceArguments(filters, optional_services); | |
| 1146 | 1146 |
| 1147 VLOG(1) << "requestDevice called with the following filters: "; | 1147 VLOG(1) << "requestDevice called with the following filters: "; |
| 1148 for (const BluetoothScanFilter& filter : filters) { | 1148 for (const BluetoothScanFilter& filter : filters) { |
| 1149 VLOG(1) << "Name: " << filter.name; | 1149 VLOG(1) << "Name: " << filter.name; |
| 1150 VLOG(1) << "Name Prefix: " << filter.namePrefix; | 1150 VLOG(1) << "Name Prefix: " << filter.namePrefix; |
| 1151 VLOG(1) << "Services:"; | 1151 VLOG(1) << "Services:"; |
| 1152 VLOG(1) << "\t["; | 1152 VLOG(1) << "\t["; |
| 1153 for (const BluetoothUUID& service : filter.services) | 1153 for (const BluetoothUUID& service : filter.services) |
| 1154 VLOG(1) << "\t\t" << service.value(); | 1154 VLOG(1) << "\t\t" << service.value(); |
| 1155 VLOG(1) << "\t]"; | 1155 VLOG(1) << "\t]"; |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1664 | 1664 |
| 1665 bool BluetoothDispatcherHost::CanFrameAccessCharacteristicInstance( | 1665 bool BluetoothDispatcherHost::CanFrameAccessCharacteristicInstance( |
| 1666 int frame_routing_id, | 1666 int frame_routing_id, |
| 1667 const std::string& characteristic_instance_id) { | 1667 const std::string& characteristic_instance_id) { |
| 1668 return QueryCacheForCharacteristic(GetOrigin(frame_routing_id), | 1668 return QueryCacheForCharacteristic(GetOrigin(frame_routing_id), |
| 1669 characteristic_instance_id) | 1669 characteristic_instance_id) |
| 1670 .outcome != CacheQueryOutcome::BAD_RENDERER; | 1670 .outcome != CacheQueryOutcome::BAD_RENDERER; |
| 1671 } | 1671 } |
| 1672 | 1672 |
| 1673 } // namespace content | 1673 } // namespace content |
| OLD | NEW |