| 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 "chrome/browser/extensions/api/bluetooth/bluetooth_api.h" | 5 #include "chrome/browser/extensions/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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 } | 165 } |
| 166 | 166 |
| 167 void BluetoothStartDiscoveryFunction::OnErrorCallback() { | 167 void BluetoothStartDiscoveryFunction::OnErrorCallback() { |
| 168 SetError(kStartDiscoveryFailed); | 168 SetError(kStartDiscoveryFailed); |
| 169 SendResponse(false); | 169 SendResponse(false); |
| 170 } | 170 } |
| 171 | 171 |
| 172 bool BluetoothStartDiscoveryFunction::DoWork( | 172 bool BluetoothStartDiscoveryFunction::DoWork( |
| 173 scoped_refptr<BluetoothAdapter> adapter) { | 173 scoped_refptr<BluetoothAdapter> adapter) { |
| 174 GetEventRouter(browser_context())->StartDiscoverySession( | 174 GetEventRouter(browser_context())->StartDiscoverySession( |
| 175 adapter, | 175 adapter.get(), |
| 176 extension_id(), | 176 extension_id(), |
| 177 base::Bind(&BluetoothStartDiscoveryFunction::OnSuccessCallback, this), | 177 base::Bind(&BluetoothStartDiscoveryFunction::OnSuccessCallback, this), |
| 178 base::Bind(&BluetoothStartDiscoveryFunction::OnErrorCallback, this)); | 178 base::Bind(&BluetoothStartDiscoveryFunction::OnErrorCallback, this)); |
| 179 | 179 |
| 180 return true; | 180 return true; |
| 181 } | 181 } |
| 182 | 182 |
| 183 void BluetoothStopDiscoveryFunction::OnSuccessCallback() { | 183 void BluetoothStopDiscoveryFunction::OnSuccessCallback() { |
| 184 SendResponse(true); | 184 SendResponse(true); |
| 185 } | 185 } |
| 186 | 186 |
| 187 void BluetoothStopDiscoveryFunction::OnErrorCallback() { | 187 void BluetoothStopDiscoveryFunction::OnErrorCallback() { |
| 188 SetError(kStopDiscoveryFailed); | 188 SetError(kStopDiscoveryFailed); |
| 189 SendResponse(false); | 189 SendResponse(false); |
| 190 } | 190 } |
| 191 | 191 |
| 192 bool BluetoothStopDiscoveryFunction::DoWork( | 192 bool BluetoothStopDiscoveryFunction::DoWork( |
| 193 scoped_refptr<BluetoothAdapter> adapter) { | 193 scoped_refptr<BluetoothAdapter> adapter) { |
| 194 GetEventRouter(browser_context())->StopDiscoverySession( | 194 GetEventRouter(browser_context())->StopDiscoverySession( |
| 195 adapter, | 195 adapter.get(), |
| 196 extension_id(), | 196 extension_id(), |
| 197 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this), | 197 base::Bind(&BluetoothStopDiscoveryFunction::OnSuccessCallback, this), |
| 198 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this)); | 198 base::Bind(&BluetoothStopDiscoveryFunction::OnErrorCallback, this)); |
| 199 | 199 |
| 200 return true; | 200 return true; |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace api | 203 } // namespace api |
| 204 } // namespace extensions | 204 } // namespace extensions |
| OLD | NEW |