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..677ed1dcaac855bbbde22182d29fe9fc08840b5a 100644 |
| --- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| +++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc |
| @@ -1219,14 +1219,32 @@ 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( |
| + web_contents->GetBrowserContext(), requesting_origin, embedding_origin)) { |
| + case ContentBrowserClient::AllowWebBluetoothResult::BLOCK_POLICY: { |
| + RecordRequestDeviceOutcome( |
| + UMARequestDeviceOutcome::BLUETOOTH_CHOOSER_POLICY_DISABLED); |
| + Send(new BluetoothMsg_RequestDeviceError( |
| + thread_id, request_id, |
| + WebBluetoothError::ChooserNotShown_APILocallyDisabled)); |
| + return; |
| + } |
| + case ContentBrowserClient::AllowWebBluetoothResult:: |
| + BLOCK_GLOBALLY_DISABLED: { |
| + // Log to the developer console. |
| + web_contents->GetMainFrame()->AddMessageToConsole( |
| + content::CONSOLE_MESSAGE_LEVEL_LOG, |
| + "Bluetooth permission has been blocked."); |
| + // Block requests. |
| + RecordRequestDeviceOutcome( |
| + UMARequestDeviceOutcome::BLUETOOTH_GLOBALLY_DISABLED); |
| + Send(new BluetoothMsg_RequestDeviceError( |
| + thread_id, request_id, |
| + WebBluetoothError::ChooserNotShown_APIGloballyDisabled)); |
| + return; |
| + } |
| + case ContentBrowserClient::AllowWebBluetoothResult::ALLOW: |
| + break; |
| } |
| // Create storage for the information that backs the chooser, and show the |
| @@ -1379,7 +1397,7 @@ void BluetoothDispatcherHost::FinishClosingChooser( |
| VLOG(1) << "Bluetooth chooser denied permission"; |
| Send(new BluetoothMsg_RequestDeviceError( |
| session->thread_id, session->request_id, |
| - WebBluetoothError::ChooserDeniedPermission)); |
| + WebBluetoothError::ChooserNotShown_BrowserDeniedPermissionToScan)); |
|
ortuno
2016/03/30 19:19:46
I think you might have meant to change the error i
Jeffrey Yasskin
2016/03/30 19:31:24
Line 1274 is just the chooser event saying that it
ortuno
2016/03/30 19:41:51
Ah you're totally right.
|
| request_device_sessions_.Remove(chooser_id); |
| return; |
| } |