| 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_socket/bluetooth_socket_api.h" | 5 #include "extensions/browser/api/bluetooth_socket/bluetooth_socket_api.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 } | 599 } |
| 600 | 600 |
| 601 void BluetoothSocketSendFunction::AsyncWorkStart() { | 601 void BluetoothSocketSendFunction::AsyncWorkStart() { |
| 602 DCHECK_CURRENTLY_ON(work_thread_id()); | 602 DCHECK_CURRENTLY_ON(work_thread_id()); |
| 603 BluetoothApiSocket* socket = GetSocket(params_->socket_id); | 603 BluetoothApiSocket* socket = GetSocket(params_->socket_id); |
| 604 if (!socket) { | 604 if (!socket) { |
| 605 error_ = kSocketNotFoundError; | 605 error_ = kSocketNotFoundError; |
| 606 return; | 606 return; |
| 607 } | 607 } |
| 608 | 608 |
| 609 socket->Send(io_buffer_, | 609 socket->Send(io_buffer_, static_cast<int>(io_buffer_size_), |
| 610 io_buffer_size_, | |
| 611 base::Bind(&BluetoothSocketSendFunction::OnSuccess, this), | 610 base::Bind(&BluetoothSocketSendFunction::OnSuccess, this), |
| 612 base::Bind(&BluetoothSocketSendFunction::OnError, this)); | 611 base::Bind(&BluetoothSocketSendFunction::OnError, this)); |
| 613 } | 612 } |
| 614 | 613 |
| 615 void BluetoothSocketSendFunction::OnSuccess(int bytes_sent) { | 614 void BluetoothSocketSendFunction::OnSuccess(int bytes_sent) { |
| 616 DCHECK_CURRENTLY_ON(work_thread_id()); | 615 DCHECK_CURRENTLY_ON(work_thread_id()); |
| 617 results_ = bluetooth_socket::Send::Results::Create(bytes_sent); | 616 results_ = bluetooth_socket::Send::Results::Create(bytes_sent); |
| 618 AsyncWorkCompleted(); | 617 AsyncWorkCompleted(); |
| 619 } | 618 } |
| 620 | 619 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 if (socket) { | 661 if (socket) { |
| 663 socket_infos.push_back(CreateSocketInfo(socket_id, socket)); | 662 socket_infos.push_back(CreateSocketInfo(socket_id, socket)); |
| 664 } | 663 } |
| 665 } | 664 } |
| 666 } | 665 } |
| 667 results_ = bluetooth_socket::GetSockets::Results::Create(socket_infos); | 666 results_ = bluetooth_socket::GetSockets::Results::Create(socket_infos); |
| 668 } | 667 } |
| 669 | 668 |
| 670 } // namespace api | 669 } // namespace api |
| 671 } // namespace extensions | 670 } // namespace extensions |
| OLD | NEW |