| 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 #ifndef DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ | 5 #ifndef DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ |
| 6 #define DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ | 6 #define DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 const serial::ConnectionOptions& options, | 43 const serial::ConnectionOptions& options, |
| 44 const OpenCompleteCallback& callback); | 44 const OpenCompleteCallback& callback); |
| 45 | 45 |
| 46 #if defined(OS_CHROMEOS) | 46 #if defined(OS_CHROMEOS) |
| 47 // Signals that the port has been opened. | 47 // Signals that the port has been opened. |
| 48 void OnPathOpened( | 48 void OnPathOpened( |
| 49 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, | 49 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner, |
| 50 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, | 50 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, |
| 51 dbus::FileDescriptor fd); | 51 dbus::FileDescriptor fd); |
| 52 | 52 |
| 53 // Signals that the permission broker failed to open the port. |
| 54 void OnPathOpenError( |
| 55 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, |
| 56 const std::string& error_name, |
| 57 const std::string& error_message); |
| 58 |
| 53 // Validates the file descriptor provided by the permission broker. | 59 // Validates the file descriptor provided by the permission broker. |
| 54 void ValidateOpenPort( | 60 void ValidateOpenPort( |
| 55 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, | 61 scoped_refptr<base::SingleThreadTaskRunner> io_thread_task_runner, |
| 56 dbus::FileDescriptor fd); | 62 dbus::FileDescriptor fd); |
| 63 |
| 64 // Reports the open error from the permission broker. |
| 65 void ReportPathOpenError(const std::string& error_name, |
| 66 const std::string& error_message); |
| 57 #endif // defined(OS_CHROMEOS) | 67 #endif // defined(OS_CHROMEOS) |
| 58 | 68 |
| 59 // Performs an async Read operation. Behavior is undefined if this is called | 69 // Performs an async Read operation. Behavior is undefined if this is called |
| 60 // while a Read is already pending. Otherwise, the Done or DoneWithError | 70 // while a Read is already pending. Otherwise, the Done or DoneWithError |
| 61 // method on |buffer| will eventually be called with a result. | 71 // method on |buffer| will eventually be called with a result. |
| 62 void Read(scoped_ptr<WritableBuffer> buffer); | 72 void Read(scoped_ptr<WritableBuffer> buffer); |
| 63 | 73 |
| 64 // Performs an async Write operation. Behavior is undefined if this is called | 74 // Performs an async Write operation. Behavior is undefined if this is called |
| 65 // while a Write is already pending. Otherwise, the Done or DoneWithError | 75 // while a Write is already pending. Otherwise, the Done or DoneWithError |
| 66 // method on |buffer| will eventually be called with a result. | 76 // method on |buffer| will eventually be called with a result. |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner_; | 254 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner_; |
| 245 | 255 |
| 246 std::string port_; | 256 std::string port_; |
| 247 | 257 |
| 248 DISALLOW_COPY_AND_ASSIGN(SerialIoHandler); | 258 DISALLOW_COPY_AND_ASSIGN(SerialIoHandler); |
| 249 }; | 259 }; |
| 250 | 260 |
| 251 } // namespace device | 261 } // namespace device |
| 252 | 262 |
| 253 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ | 263 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ |
| OLD | NEW |