Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Unified Diff: extensions/browser/api/bluetooth/bluetooth_event_router.cc

Issue 1540323002: Replace NOTREACHED with VLOG in BluetoothEventRouter::AddPairingDelegateImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698