| 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_api.h" | 5 #include "extensions/browser/api/bluetooth/bluetooth_api.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 return true; | 136 return true; |
| 137 } | 137 } |
| 138 | 138 |
| 139 BluetoothGetDeviceFunction::~BluetoothGetDeviceFunction() {} | 139 BluetoothGetDeviceFunction::~BluetoothGetDeviceFunction() {} |
| 140 | 140 |
| 141 bool BluetoothGetDeviceFunction::DoWork( | 141 bool BluetoothGetDeviceFunction::DoWork( |
| 142 scoped_refptr<BluetoothAdapter> adapter) { | 142 scoped_refptr<BluetoothAdapter> adapter) { |
| 143 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 143 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 144 | 144 |
| 145 scoped_ptr<GetDevice::Params> params(GetDevice::Params::Create(*args_)); | 145 std::unique_ptr<GetDevice::Params> params(GetDevice::Params::Create(*args_)); |
| 146 EXTENSION_FUNCTION_VALIDATE(params.get() != NULL); | 146 EXTENSION_FUNCTION_VALIDATE(params.get() != NULL); |
| 147 | 147 |
| 148 BluetoothDevice* device = adapter->GetDevice(params->device_address); | 148 BluetoothDevice* device = adapter->GetDevice(params->device_address); |
| 149 if (device) { | 149 if (device) { |
| 150 bluetooth::Device extension_device; | 150 bluetooth::Device extension_device; |
| 151 bluetooth::BluetoothDeviceToApiDevice(*device, &extension_device); | 151 bluetooth::BluetoothDeviceToApiDevice(*device, &extension_device); |
| 152 SetResult(extension_device.ToValue().release()); | 152 SetResult(extension_device.ToValue().release()); |
| 153 SendResponse(true); | 153 SendResponse(true); |
| 154 } else { | 154 } else { |
| 155 SetError(kInvalidDevice); | 155 SetError(kInvalidDevice); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 ->StopDiscoverySession( | 194 ->StopDiscoverySession( |
| 195 adapter.get(), GetExtensionId(), | 195 adapter.get(), GetExtensionId(), |
| 196 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this), | 196 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this), |
| 197 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this)); | 197 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this)); |
| 198 | 198 |
| 199 return true; | 199 return true; |
| 200 } | 200 } |
| 201 | 201 |
| 202 } // namespace api | 202 } // namespace api |
| 203 } // namespace extensions | 203 } // namespace extensions |
| OLD | NEW |