| 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 "chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h" | 5 #include "chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_api.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api_socket.h" | 7 #include "chrome/browser/extensions/api/bluetooth/bluetooth_api_socket.h" |
| 8 #include "chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_event_
dispatcher.h" | 8 #include "chrome/browser/extensions/api/bluetooth_socket/bluetooth_socket_event_
dispatcher.h" |
| 9 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 | 61 |
| 62 } // namespace | 62 } // namespace |
| 63 | 63 |
| 64 namespace extensions { | 64 namespace extensions { |
| 65 namespace api { | 65 namespace api { |
| 66 | 66 |
| 67 BluetoothSocketAsyncApiFunction::BluetoothSocketAsyncApiFunction() {} | 67 BluetoothSocketAsyncApiFunction::BluetoothSocketAsyncApiFunction() {} |
| 68 | 68 |
| 69 BluetoothSocketAsyncApiFunction::~BluetoothSocketAsyncApiFunction() {} | 69 BluetoothSocketAsyncApiFunction::~BluetoothSocketAsyncApiFunction() {} |
| 70 | 70 |
| 71 bool BluetoothSocketAsyncApiFunction::RunImpl() { | 71 bool BluetoothSocketAsyncApiFunction::RunAsync() { |
| 72 if (!PrePrepare() || !Prepare()) { | 72 if (!PrePrepare() || !Prepare()) { |
| 73 return false; | 73 return false; |
| 74 } | 74 } |
| 75 AsyncWorkStart(); | 75 AsyncWorkStart(); |
| 76 return true; | 76 return true; |
| 77 } | 77 } |
| 78 | 78 |
| 79 bool BluetoothSocketAsyncApiFunction::PrePrepare() { | 79 bool BluetoothSocketAsyncApiFunction::PrePrepare() { |
| 80 manager_ = ApiResourceManager<BluetoothApiSocket>::Get(browser_context()); | 80 manager_ = ApiResourceManager<BluetoothApiSocket>::Get(browser_context()); |
| 81 DCHECK(manager_) | 81 DCHECK(manager_) |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 socket->set_paused(params_->paused); | 201 socket->set_paused(params_->paused); |
| 202 if (!params_->paused) { | 202 if (!params_->paused) { |
| 203 socket_event_dispatcher_->OnSocketResume(extension_id(), | 203 socket_event_dispatcher_->OnSocketResume(extension_id(), |
| 204 params_->socket_id); | 204 params_->socket_id); |
| 205 } | 205 } |
| 206 } | 206 } |
| 207 | 207 |
| 208 results_ = bluetooth_socket::SetPaused::Results::Create(); | 208 results_ = bluetooth_socket::SetPaused::Results::Create(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 bool BluetoothSocketListenUsingRfcommFunction::RunImpl() { | 211 bool BluetoothSocketListenUsingRfcommFunction::RunAsync() { |
| 212 // TODO(keybuk): Implement. | 212 // TODO(keybuk): Implement. |
| 213 SetError("Not yet implemented."); | 213 SetError("Not yet implemented."); |
| 214 return false; | 214 return false; |
| 215 } | 215 } |
| 216 | 216 |
| 217 bool BluetoothSocketListenUsingInsecureRfcommFunction::RunImpl() { | 217 bool BluetoothSocketListenUsingInsecureRfcommFunction::RunAsync() { |
| 218 // TODO(keybuk): Implement. | 218 // TODO(keybuk): Implement. |
| 219 SetError("Not yet implemented."); | 219 SetError("Not yet implemented."); |
| 220 return false; | 220 return false; |
| 221 } | 221 } |
| 222 | 222 |
| 223 bool BluetoothSocketListenUsingL2capFunction::RunImpl() { | 223 bool BluetoothSocketListenUsingL2capFunction::RunAsync() { |
| 224 // TODO(keybuk): Implement. | 224 // TODO(keybuk): Implement. |
| 225 SetError("Not yet implemented."); | 225 SetError("Not yet implemented."); |
| 226 return false; | 226 return false; |
| 227 } | 227 } |
| 228 | 228 |
| 229 bool BluetoothSocketConnectFunction::RunImpl() { | 229 bool BluetoothSocketConnectFunction::RunAsync() { |
| 230 // TODO(keybuk): Implement. | 230 // TODO(keybuk): Implement. |
| 231 SetError("Not yet implemented."); | 231 SetError("Not yet implemented."); |
| 232 return false; | 232 return false; |
| 233 } | 233 } |
| 234 | 234 |
| 235 BluetoothSocketDisconnectFunction::BluetoothSocketDisconnectFunction() {} | 235 BluetoothSocketDisconnectFunction::BluetoothSocketDisconnectFunction() {} |
| 236 | 236 |
| 237 BluetoothSocketDisconnectFunction::~BluetoothSocketDisconnectFunction() {} | 237 BluetoothSocketDisconnectFunction::~BluetoothSocketDisconnectFunction() {} |
| 238 | 238 |
| 239 bool BluetoothSocketDisconnectFunction::Prepare() { | 239 bool BluetoothSocketDisconnectFunction::Prepare() { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 if (socket) { | 365 if (socket) { |
| 366 socket_infos.push_back(CreateSocketInfo(socket_id, socket)); | 366 socket_infos.push_back(CreateSocketInfo(socket_id, socket)); |
| 367 } | 367 } |
| 368 } | 368 } |
| 369 } | 369 } |
| 370 results_ = bluetooth_socket::GetSockets::Results::Create(socket_infos); | 370 results_ = bluetooth_socket::GetSockets::Results::Create(socket_infos); |
| 371 } | 371 } |
| 372 | 372 |
| 373 } // namespace api | 373 } // namespace api |
| 374 } // namespace extensions | 374 } // namespace extensions |
| OLD | NEW |