| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_low_energy/bluetooth_low_energy_event
_router.h" | 5 #include "extensions/browser/api/bluetooth_low_energy/bluetooth_low_energy_event
_router.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <iterator> | 8 #include <iterator> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 service->Delete(); | 271 service->Delete(); |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 | 274 |
| 275 adapter_->RemoveObserver(this); | 275 adapter_->RemoveObserver(this); |
| 276 adapter_ = NULL; | 276 adapter_ = NULL; |
| 277 } | 277 } |
| 278 | 278 |
| 279 bool BluetoothLowEnergyEventRouter::IsBluetoothSupported() const { | 279 bool BluetoothLowEnergyEventRouter::IsBluetoothSupported() const { |
| 280 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 280 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 281 return adapter_.get() || | 281 return BluetoothAdapterFactory::IsBluetoothSupported(); |
| 282 BluetoothAdapterFactory::IsBluetoothAdapterAvailable(); | |
| 283 } | 282 } |
| 284 | 283 |
| 285 bool BluetoothLowEnergyEventRouter::InitializeAdapterAndInvokeCallback( | 284 bool BluetoothLowEnergyEventRouter::InitializeAdapterAndInvokeCallback( |
| 286 const base::Closure& callback) { | 285 const base::Closure& callback) { |
| 287 if (!IsBluetoothSupported()) | 286 if (!IsBluetoothSupported()) |
| 288 return false; | 287 return false; |
| 289 | 288 |
| 290 if (adapter_.get()) { | 289 if (adapter_.get()) { |
| 291 callback.Run(); | 290 callback.Run(); |
| 292 return true; | 291 return true; |
| (...skipping 1593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1886 requests_[extension_id] = std::move(new_request_id_map); | 1885 requests_[extension_id] = std::move(new_request_id_map); |
| 1887 } else { | 1886 } else { |
| 1888 request_id_map = iter->second.get(); | 1887 request_id_map = iter->second.get(); |
| 1889 } | 1888 } |
| 1890 | 1889 |
| 1891 (*request_id_map)[++last_callback_request_id_] = std::move(request); | 1890 (*request_id_map)[++last_callback_request_id_] = std::move(request); |
| 1892 return last_callback_request_id_; | 1891 return last_callback_request_id_; |
| 1893 } | 1892 } |
| 1894 | 1893 |
| 1895 } // namespace extensions | 1894 } // namespace extensions |
| OLD | NEW |