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 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1212 return; | 1212 return; |
| 1213 } | 1213 } |
| 1214 | 1214 |
| 1215 // The renderer should never send empty filters. | 1215 // The renderer should never send empty filters. |
| 1216 if (HasEmptyOrInvalidFilter(filters)) { | 1216 if (HasEmptyOrInvalidFilter(filters)) { |
| 1217 bad_message::ReceivedBadMessage(this, | 1217 bad_message::ReceivedBadMessage(this, |
| 1218 bad_message::BDH_EMPTY_OR_INVALID_FILTERS); | 1218 bad_message::BDH_EMPTY_OR_INVALID_FILTERS); |
| 1219 return; | 1219 return; |
| 1220 } | 1220 } |
| 1221 | 1221 |
| 1222 if (!GetContentClient()->browser()->AllowWebBluetooth( | 1222 switch (GetContentClient()->browser()->AllowWebBluetooth( |
|
ortuno
2016/03/29 17:48:46
Doing this so late in OnRequestDeviceImpl seems wr
Jeffrey Yasskin
2016/03/29 23:13:04
It probably makes sense to reconsider a lot of the
| |
| 1223 web_contents->GetBrowserContext(), requesting_origin, | 1223 web_contents->GetBrowserContext(), requesting_origin, embedding_origin)) { |
| 1224 embedding_origin)) { | 1224 case ContentBrowserClient::AllowWebBluetoothResult::BLOCK_POLICY: { |
| 1225 RecordRequestDeviceOutcome( | 1225 RecordRequestDeviceOutcome( |
| 1226 UMARequestDeviceOutcome::BLUETOOTH_CHOOSER_GLOBALLY_DISABLED); | 1226 UMARequestDeviceOutcome::BLUETOOTH_CHOOSER_GLOBALLY_DISABLED); |
| 1227 Send(new BluetoothMsg_RequestDeviceError( | 1227 Send(new BluetoothMsg_RequestDeviceError( |
| 1228 thread_id, request_id, WebBluetoothError::ChooserDisabled)); | 1228 thread_id, request_id, WebBluetoothError::ChooserDisabled)); |
| 1229 return; | 1229 return; |
| 1230 } | |
| 1231 case ContentBrowserClient::AllowWebBluetoothResult::BLOCK_KILL_SWITCH: { | |
|
ortuno
2016/03/29 17:48:46
What do you think about checking if the WebBluetoo
Jeffrey Yasskin
2016/03/29 23:13:04
For now, I think that prevents me from testing thi
| |
| 1232 // Log to the developer console. | |
| 1233 web_contents->GetMainFrame()->AddMessageToConsole( | |
| 1234 content::CONSOLE_MESSAGE_LEVEL_LOG, | |
| 1235 "Bluetooth permission has been blocked."); | |
| 1236 // Block requests. | |
| 1237 RecordRequestDeviceOutcome( | |
| 1238 UMARequestDeviceOutcome::BLUETOOTH_KILL_SWITCH_ENABLED); | |
| 1239 Send(new BluetoothMsg_RequestDeviceError( | |
| 1240 thread_id, request_id, WebBluetoothError::KillSwitchEnabled)); | |
| 1241 return; | |
| 1242 } | |
| 1243 case ContentBrowserClient::AllowWebBluetoothResult::ALLOW: | |
| 1244 break; | |
| 1230 } | 1245 } |
| 1231 | 1246 |
| 1232 // Create storage for the information that backs the chooser, and show the | 1247 // Create storage for the information that backs the chooser, and show the |
| 1233 // chooser. | 1248 // chooser. |
| 1234 RequestDeviceSession* const session = new RequestDeviceSession( | 1249 RequestDeviceSession* const session = new RequestDeviceSession( |
| 1235 thread_id, request_id, frame_routing_id, requesting_origin, filters, | 1250 thread_id, request_id, frame_routing_id, requesting_origin, filters, |
| 1236 optional_services_blacklist_filtered); | 1251 optional_services_blacklist_filtered); |
| 1237 int chooser_id = request_device_sessions_.Add(session); | 1252 int chooser_id = request_device_sessions_.Add(session); |
| 1238 | 1253 |
| 1239 BluetoothChooser::EventHandler chooser_event_handler = | 1254 BluetoothChooser::EventHandler chooser_event_handler = |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1664 | 1679 |
| 1665 bool BluetoothDispatcherHost::CanFrameAccessCharacteristicInstance( | 1680 bool BluetoothDispatcherHost::CanFrameAccessCharacteristicInstance( |
| 1666 int frame_routing_id, | 1681 int frame_routing_id, |
| 1667 const std::string& characteristic_instance_id) { | 1682 const std::string& characteristic_instance_id) { |
| 1668 return QueryCacheForCharacteristic(GetOrigin(frame_routing_id), | 1683 return QueryCacheForCharacteristic(GetOrigin(frame_routing_id), |
| 1669 characteristic_instance_id) | 1684 characteristic_instance_id) |
| 1670 .outcome != CacheQueryOutcome::BAD_RENDERER; | 1685 .outcome != CacheQueryOutcome::BAD_RENDERER; |
| 1671 } | 1686 } |
| 1672 | 1687 |
| 1673 } // namespace content | 1688 } // namespace content |
| OLD | NEW |