| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "extensions/browser/api/bluetooth/bluetooth_event_router.h" | 5 #include "extensions/browser/api/bluetooth/bluetooth_event_router.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 continue; | 323 continue; |
| 324 } | 324 } |
| 325 delete session; | 325 delete session; |
| 326 } | 326 } |
| 327 discovery_session_map_.swap(active_session_map); | 327 discovery_session_map_.swap(active_session_map); |
| 328 } | 328 } |
| 329 | 329 |
| 330 DispatchAdapterStateEvent(); | 330 DispatchAdapterStateEvent(); |
| 331 | 331 |
| 332 // Release the adapter after dispatching the event. | 332 // Release the adapter after dispatching the event. |
| 333 if (!discovering) | 333 if (!discovering) { |
| 334 MaybeReleaseAdapter(); | 334 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 335 FROM_HERE, base::Bind(&BluetoothEventRouter::MaybeReleaseAdapter, |
| 336 weak_ptr_factory_.GetWeakPtr())); |
| 337 } |
| 335 } | 338 } |
| 336 | 339 |
| 337 void BluetoothEventRouter::DeviceAdded(device::BluetoothAdapter* adapter, | 340 void BluetoothEventRouter::DeviceAdded(device::BluetoothAdapter* adapter, |
| 338 device::BluetoothDevice* device) { | 341 device::BluetoothDevice* device) { |
| 339 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 342 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 340 if (adapter != adapter_.get()) { | 343 if (adapter != adapter_.get()) { |
| 341 BLUETOOTH_LOG(DEBUG) << "Ignoring event for adapter " | 344 BLUETOOTH_LOG(DEBUG) << "Ignoring event for adapter " |
| 342 << adapter->GetAddress(); | 345 << adapter->GetAddress(); |
| 343 return; | 346 return; |
| 344 } | 347 } |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 } | 503 } |
| 501 | 504 |
| 502 void BluetoothEventRouter::OnExtensionUnloaded( | 505 void BluetoothEventRouter::OnExtensionUnloaded( |
| 503 content::BrowserContext* browser_context, | 506 content::BrowserContext* browser_context, |
| 504 const Extension* extension, | 507 const Extension* extension, |
| 505 UnloadedExtensionInfo::Reason reason) { | 508 UnloadedExtensionInfo::Reason reason) { |
| 506 CleanUpForExtension(extension->id()); | 509 CleanUpForExtension(extension->id()); |
| 507 } | 510 } |
| 508 | 511 |
| 509 } // namespace extensions | 512 } // namespace extensions |
| OLD | NEW |