diff options
author | stevenjb <stevenjb@chromium.org> | 2015-12-28 12:12:50 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-28 20:13:41 +0000 |
commit | 2429595387b523ebcb83b8957cc57277c076d005 (patch) | |
tree | 6171a0040323b51d65ae5e14d23691083b73fa3e /extensions | |
parent | de06c0c71faa3ecef908e874710eefb09c31d3a9 (diff) | |
download | chromium_src-2429595387b523ebcb83b8957cc57277c076d005.zip chromium_src-2429595387b523ebcb83b8957cc57277c076d005.tar.gz chromium_src-2429595387b523ebcb83b8957cc57277c076d005.tar.bz2 |
Replace NOTREACHED with VLOG in BluetoothEventRouter::AddPairingDelegateImpl
Multiple instances of the same WebUI URL can legitimately share a pairing delegate.
BUG=568426
Review URL: https://codereview.chromium.org/1540323002
Cr-Commit-Position: refs/heads/master@{#367007}
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/browser/api/bluetooth/bluetooth_event_router.cc | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/extensions/browser/api/bluetooth/bluetooth_event_router.cc b/extensions/browser/api/bluetooth/bluetooth_event_router.cc index d3365da..32606fab 100644 --- a/extensions/browser/api/bluetooth/bluetooth_event_router.cc +++ b/extensions/browser/api/bluetooth/bluetooth_event_router.cc @@ -241,21 +241,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 adapter for extension_id: " << extension_id; 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( |