Index: extensions/browser/api/bluetooth/bluetooth_event_router.cc |
diff --git a/extensions/browser/api/bluetooth/bluetooth_event_router.cc b/extensions/browser/api/bluetooth/bluetooth_event_router.cc |
index 613edd0a9a412f98d27eb02260e3f9ba54ec0a9c..1ee75d2c39671c588b0ab4b5b5ef3ed195ea6091 100644 |
--- a/extensions/browser/api/bluetooth/bluetooth_event_router.cc |
+++ b/extensions/browser/api/bluetooth/bluetooth_event_router.cc |
@@ -240,21 +240,22 @@ void BluetoothEventRouter::AddPairingDelegate(const std::string& extension_id) { |
void BluetoothEventRouter::AddPairingDelegateImpl( |
const std::string& extension_id) { |
if (!adapter_.get()) { |
- LOG(ERROR) << "Unable to get adatper."; |
+ LOG(ERROR) << "Unable to get adatper for extension_id: " << extension_id; |
michaelpg
2015/12/22 00:49:48
adapter
stevenjb
2015/12/28 18:22:11
Done.
|
return; |
} |
- if (!ContainsKey(pairing_delegate_map_, extension_id)) { |
- BluetoothApiPairingDelegate* delegate = |
- new BluetoothApiPairingDelegate(browser_context_); |
- DCHECK(adapter_.get()); |
- adapter_->AddPairingDelegate( |
- delegate, device::BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH); |
- pairing_delegate_map_[extension_id] = delegate; |
- } else { |
- LOG(ERROR) << "Pairing delegate already exists for extension. " |
- << "There should be at most one onPairing listener."; |
- NOTREACHED(); |
+ if (ContainsKey(pairing_delegate_map_, extension_id)) { |
+ // For WebUI there may be more than one page open to the same url |
+ // (e.g. chrome://settings). These will share the same pairing delegate. |
+ VLOG(1) << "Pairing delegate already exists for extension_id: " |
+ << extension_id; |
+ return; |
} |
+ BluetoothApiPairingDelegate* delegate = |
+ new BluetoothApiPairingDelegate(browser_context_); |
+ DCHECK(adapter_.get()); |
+ adapter_->AddPairingDelegate( |
+ delegate, device::BluetoothAdapter::PAIRING_DELEGATE_PRIORITY_HIGH); |
+ pairing_delegate_map_[extension_id] = delegate; |
} |
void BluetoothEventRouter::RemovePairingDelegate( |