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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 SendResponse(true); | 163 SendResponse(true); |
164 } | 164 } |
165 | 165 |
166 void BluetoothStartDiscoveryFunction::OnErrorCallback() { | 166 void BluetoothStartDiscoveryFunction::OnErrorCallback() { |
167 SetError(kStartDiscoveryFailed); | 167 SetError(kStartDiscoveryFailed); |
168 SendResponse(false); | 168 SendResponse(false); |
169 } | 169 } |
170 | 170 |
171 bool BluetoothStartDiscoveryFunction::DoWork( | 171 bool BluetoothStartDiscoveryFunction::DoWork( |
172 scoped_refptr<BluetoothAdapter> adapter) { | 172 scoped_refptr<BluetoothAdapter> adapter) { |
173 GetEventRouter(browser_context())->StartDiscoverySession( | 173 GetEventRouter(browser_context()) |
174 adapter.get(), | 174 ->StartDiscoverySession( |
175 extension_id(), | 175 adapter.get(), GetExtensionId(), |
176 base::Bind(&BluetoothStartDiscoveryFunction::OnSuccessCallback, this), | 176 base::Bind(&BluetoothStartDiscoveryFunction::OnSuccessCallback, this), |
177 base::Bind(&BluetoothStartDiscoveryFunction::OnErrorCallback, this)); | 177 base::Bind(&BluetoothStartDiscoveryFunction::OnErrorCallback, this)); |
178 | 178 |
179 return true; | 179 return true; |
180 } | 180 } |
181 | 181 |
182 void BluetoothStopDiscoveryFunction::OnSuccessCallback() { | 182 void BluetoothStopDiscoveryFunction::OnSuccessCallback() { |
183 SendResponse(true); | 183 SendResponse(true); |
184 } | 184 } |
185 | 185 |
186 void BluetoothStopDiscoveryFunction::OnErrorCallback() { | 186 void BluetoothStopDiscoveryFunction::OnErrorCallback() { |
187 SetError(kStopDiscoveryFailed); | 187 SetError(kStopDiscoveryFailed); |
188 SendResponse(false); | 188 SendResponse(false); |
189 } | 189 } |
190 | 190 |
191 bool BluetoothStopDiscoveryFunction::DoWork( | 191 bool BluetoothStopDiscoveryFunction::DoWork( |
192 scoped_refptr<BluetoothAdapter> adapter) { | 192 scoped_refptr<BluetoothAdapter> adapter) { |
193 GetEventRouter(browser_context())->StopDiscoverySession( | 193 GetEventRouter(browser_context()) |
194 adapter.get(), | 194 ->StopDiscoverySession( |
195 extension_id(), | 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 |