| 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_api_socket.h" | 5 #include "extensions/browser/api/bluetooth_socket/bluetooth_api_socket.h" |
| 6 | 6 |
| 7 #include "device/bluetooth/bluetooth_socket.h" | 7 #include "device/bluetooth/bluetooth_socket.h" |
| 8 #include "net/base/io_buffer.h" | 8 #include "net/base/io_buffer.h" |
| 9 | 9 |
| 10 namespace { | 10 namespace { |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 switch (reason) { | 132 switch (reason) { |
| 133 case device::BluetoothSocket::kIOPending: | 133 case device::BluetoothSocket::kIOPending: |
| 134 error_reason = BluetoothApiSocket::kIOPending; | 134 error_reason = BluetoothApiSocket::kIOPending; |
| 135 break; | 135 break; |
| 136 case device::BluetoothSocket::kDisconnected: | 136 case device::BluetoothSocket::kDisconnected: |
| 137 error_reason = BluetoothApiSocket::kDisconnected; | 137 error_reason = BluetoothApiSocket::kDisconnected; |
| 138 break; | 138 break; |
| 139 case device::BluetoothSocket::kSystemError: | 139 case device::BluetoothSocket::kSystemError: |
| 140 error_reason = BluetoothApiSocket::kSystemError; | 140 error_reason = BluetoothApiSocket::kSystemError; |
| 141 break; | 141 break; |
| 142 default: | |
| 143 NOTREACHED(); | |
| 144 } | 142 } |
| 145 error_callback.Run(error_reason, message); | 143 error_callback.Run(error_reason, message); |
| 146 } | 144 } |
| 147 | 145 |
| 148 void BluetoothApiSocket::Send(scoped_refptr<net::IOBuffer> buffer, | 146 void BluetoothApiSocket::Send(scoped_refptr<net::IOBuffer> buffer, |
| 149 int buffer_size, | 147 int buffer_size, |
| 150 const SendCompletionCallback& success_callback, | 148 const SendCompletionCallback& success_callback, |
| 151 const ErrorCompletionCallback& error_callback) { | 149 const ErrorCompletionCallback& error_callback) { |
| 152 DCHECK(content::BrowserThread::CurrentlyOn(kThreadId)); | 150 DCHECK(content::BrowserThread::CurrentlyOn(kThreadId)); |
| 153 | 151 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 | 186 |
| 189 // static | 187 // static |
| 190 void BluetoothApiSocket::OnSocketAcceptError( | 188 void BluetoothApiSocket::OnSocketAcceptError( |
| 191 const ErrorCompletionCallback& error_callback, | 189 const ErrorCompletionCallback& error_callback, |
| 192 const std::string& message) { | 190 const std::string& message) { |
| 193 DCHECK(content::BrowserThread::CurrentlyOn(kThreadId)); | 191 DCHECK(content::BrowserThread::CurrentlyOn(kThreadId)); |
| 194 error_callback.Run(BluetoothApiSocket::kSystemError, message); | 192 error_callback.Run(BluetoothApiSocket::kSystemError, message); |
| 195 } | 193 } |
| 196 | 194 |
| 197 } // namespace extensions | 195 } // namespace extensions |
| OLD | NEW |