Chromium Code Reviews| Index: content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| diff --git a/content/browser/bluetooth/bluetooth_dispatcher_host.cc b/content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| index b69fa4fa49f19a3632cda132998f947eec1a764d..9a189729b8941e50c3f094d8fe4a872b036fbd9b 100644 |
| --- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| +++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| @@ -1219,14 +1219,29 @@ void BluetoothDispatcherHost::OnRequestDeviceImpl( |
| return; |
| } |
| - if (!GetContentClient()->browser()->AllowWebBluetooth( |
| - web_contents->GetBrowserContext(), requesting_origin, |
| - embedding_origin)) { |
| - RecordRequestDeviceOutcome( |
| - UMARequestDeviceOutcome::BLUETOOTH_CHOOSER_GLOBALLY_DISABLED); |
| - Send(new BluetoothMsg_RequestDeviceError( |
| - thread_id, request_id, WebBluetoothError::ChooserDisabled)); |
| - return; |
| + 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
|
| + web_contents->GetBrowserContext(), requesting_origin, embedding_origin)) { |
| + case ContentBrowserClient::AllowWebBluetoothResult::BLOCK_POLICY: { |
| + RecordRequestDeviceOutcome( |
| + UMARequestDeviceOutcome::BLUETOOTH_CHOOSER_GLOBALLY_DISABLED); |
| + Send(new BluetoothMsg_RequestDeviceError( |
| + thread_id, request_id, WebBluetoothError::ChooserDisabled)); |
| + return; |
| + } |
| + 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
|
| + // Log to the developer console. |
| + web_contents->GetMainFrame()->AddMessageToConsole( |
| + content::CONSOLE_MESSAGE_LEVEL_LOG, |
| + "Bluetooth permission has been blocked."); |
| + // Block requests. |
| + RecordRequestDeviceOutcome( |
| + UMARequestDeviceOutcome::BLUETOOTH_KILL_SWITCH_ENABLED); |
| + Send(new BluetoothMsg_RequestDeviceError( |
| + thread_id, request_id, WebBluetoothError::KillSwitchEnabled)); |
| + return; |
| + } |
| + case ContentBrowserClient::AllowWebBluetoothResult::ALLOW: |
| + break; |
| } |
| // Create storage for the information that backs the chooser, and show the |