Chromium Code Reviews| 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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 694 } | 694 } |
| 695 | 695 |
| 696 void BluetoothDispatcherHost::OnGATTServerDisconnect( | 696 void BluetoothDispatcherHost::OnGATTServerDisconnect( |
| 697 int thread_id, | 697 int thread_id, |
| 698 int frame_routing_id, | 698 int frame_routing_id, |
| 699 const std::string& device_id) { | 699 const std::string& device_id) { |
| 700 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 700 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 701 RecordWebBluetoothFunctionCall( | 701 RecordWebBluetoothFunctionCall( |
| 702 UMAWebBluetoothFunction::REMOTE_GATT_SERVER_DISCONNECT); | 702 UMAWebBluetoothFunction::REMOTE_GATT_SERVER_DISCONNECT); |
| 703 | 703 |
| 704 // Make sure the origin is allowed to access the device. We perform this check | |
|
Jeffrey Yasskin
2016/04/04 17:06:39
Add a comment about why we're *not* checking the o
ortuno
2016/04/04 18:04:11
Done.
| |
| 705 // in case a hostile renderer is trying to disconnect a device that the | |
| 706 // renderer is not allowed to access. | |
| 707 if (allowed_devices_map_.GetDeviceAddress(GetOrigin(frame_routing_id), | |
| 708 device_id) | |
| 709 .empty()) { | |
| 710 bad_message::ReceivedBadMessage( | |
| 711 this, bad_message::BDH_DEVICE_NOT_ALLOWED_FOR_ORIGIN); | |
| 712 return; | |
| 713 } | |
| 714 | |
| 715 RenderFrameHostImpl* render_frame_host = | 704 RenderFrameHostImpl* render_frame_host = |
| 716 RenderFrameHostImpl::FromID(render_process_id_, frame_routing_id); | 705 RenderFrameHostImpl::FromID(render_process_id_, frame_routing_id); |
| 717 WebContents* web_contents = | 706 WebContents* web_contents = |
| 718 WebContents::FromRenderFrameHost(render_frame_host); | 707 WebContents::FromRenderFrameHost(render_frame_host); |
| 719 if (web_contents) { | 708 if (web_contents) { |
| 720 web_contents->SetBluetoothDeviceConnected(false); | 709 web_contents->SetBluetoothDeviceConnected(false); |
| 721 } | 710 } |
| 722 | 711 |
| 723 // The last BluetoothGattConnection for a device closes the connection when | 712 // The last BluetoothGattConnection for a device closes the connection when |
| 724 // it's destroyed. | 713 // it's destroyed. |
| (...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1621 | 1610 |
| 1622 bool BluetoothDispatcherHost::CanFrameAccessCharacteristicInstance( | 1611 bool BluetoothDispatcherHost::CanFrameAccessCharacteristicInstance( |
| 1623 int frame_routing_id, | 1612 int frame_routing_id, |
| 1624 const std::string& characteristic_instance_id) { | 1613 const std::string& characteristic_instance_id) { |
| 1625 return QueryCacheForCharacteristic(GetOrigin(frame_routing_id), | 1614 return QueryCacheForCharacteristic(GetOrigin(frame_routing_id), |
| 1626 characteristic_instance_id) | 1615 characteristic_instance_id) |
| 1627 .outcome != CacheQueryOutcome::BAD_RENDERER; | 1616 .outcome != CacheQueryOutcome::BAD_RENDERER; |
| 1628 } | 1617 } |
| 1629 | 1618 |
| 1630 } // namespace content | 1619 } // namespace content |
| OLD | NEW |