| 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 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 BluetoothEventRouter::~BluetoothEventRouter() { | 52 BluetoothEventRouter::~BluetoothEventRouter() { |
| 53 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 53 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 54 if (adapter_.get()) { | 54 if (adapter_.get()) { |
| 55 adapter_->RemoveObserver(this); | 55 adapter_->RemoveObserver(this); |
| 56 adapter_ = NULL; | 56 adapter_ = NULL; |
| 57 } | 57 } |
| 58 CleanUpAllExtensions(); | 58 CleanUpAllExtensions(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 bool BluetoothEventRouter::IsBluetoothSupported() const { | 61 bool BluetoothEventRouter::IsBluetoothSupported() const { |
| 62 #if defined(OS_LINUX) |
| 63 return true; |
| 64 #endif |
| 62 return adapter_.get() || | 65 return adapter_.get() || |
| 63 device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable(); | 66 device::BluetoothAdapterFactory::IsBluetoothAdapterAvailable(); |
| 64 } | 67 } |
| 65 | 68 |
| 66 void BluetoothEventRouter::GetAdapter( | 69 void BluetoothEventRouter::GetAdapter( |
| 67 const device::BluetoothAdapterFactory::AdapterCallback& callback) { | 70 const device::BluetoothAdapterFactory::AdapterCallback& callback) { |
| 68 if (adapter_.get()) { | 71 if (adapter_.get()) { |
| 69 callback.Run(scoped_refptr<device::BluetoothAdapter>(adapter_)); | 72 callback.Run(scoped_refptr<device::BluetoothAdapter>(adapter_)); |
| 70 return; | 73 return; |
| 71 } | 74 } |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 } | 420 } |
| 418 | 421 |
| 419 void BluetoothEventRouter::OnExtensionUnloaded( | 422 void BluetoothEventRouter::OnExtensionUnloaded( |
| 420 content::BrowserContext* browser_context, | 423 content::BrowserContext* browser_context, |
| 421 const Extension* extension, | 424 const Extension* extension, |
| 422 UnloadedExtensionInfo::Reason reason) { | 425 UnloadedExtensionInfo::Reason reason) { |
| 423 CleanUpForExtension(extension->id()); | 426 CleanUpForExtension(extension->id()); |
| 424 } | 427 } |
| 425 | 428 |
| 426 } // namespace extensions | 429 } // namespace extensions |
| OLD | NEW |