| 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 "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 serial::SendError write_cancel_reason() const { return write_cancel_reason_; } | 184 serial::SendError write_cancel_reason() const { return write_cancel_reason_; } |
| 185 | 185 |
| 186 bool write_canceled() const { return write_canceled_; } | 186 bool write_canceled() const { return write_canceled_; } |
| 187 | 187 |
| 188 const serial::ConnectionOptions& options() const { return options_; } | 188 const serial::ConnectionOptions& options() const { return options_; } |
| 189 | 189 |
| 190 // Possibly fixes up a serial port path name in a platform-specific manner. | 190 // Possibly fixes up a serial port path name in a platform-specific manner. |
| 191 static std::string MaybeFixUpPortName(const std::string& port_name); | 191 static std::string MaybeFixUpPortName(const std::string& port_name); |
| 192 | 192 |
| 193 base::SingleThreadTaskRunner* file_thread_task_runner() const { | |
| 194 return file_thread_task_runner_.get(); | |
| 195 } | |
| 196 | |
| 197 base::SingleThreadTaskRunner* ui_thread_task_runner() const { | |
| 198 return ui_thread_task_runner_.get(); | |
| 199 } | |
| 200 | |
| 201 const std::string& port() const { return port_; } | |
| 202 | |
| 203 private: | 193 private: |
| 204 friend class base::RefCounted<SerialIoHandler>; | 194 friend class base::RefCounted<SerialIoHandler>; |
| 205 | 195 |
| 206 void MergeConnectionOptions(const serial::ConnectionOptions& options); | 196 void MergeConnectionOptions(const serial::ConnectionOptions& options); |
| 207 | 197 |
| 208 // Continues an Open operation on the FILE thread. | 198 // Continues an Open operation on the FILE thread. |
| 209 void StartOpen(const std::string& port, | 199 void StartOpen(const std::string& port, |
| 210 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); | 200 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); |
| 211 | 201 |
| 212 // Finalizes an Open operation (continued from StartOpen) on the IO thread. | 202 // Finalizes an Open operation (continued from StartOpen) on the IO thread. |
| (...skipping 19 matching lines...) Expand all Loading... |
| 232 serial::SendError write_cancel_reason_; | 222 serial::SendError write_cancel_reason_; |
| 233 bool write_canceled_; | 223 bool write_canceled_; |
| 234 | 224 |
| 235 // Callback to handle the completion of a pending Open() request. | 225 // Callback to handle the completion of a pending Open() request. |
| 236 OpenCompleteCallback open_complete_; | 226 OpenCompleteCallback open_complete_; |
| 237 | 227 |
| 238 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; | 228 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; |
| 239 // On Chrome OS, PermissionBrokerClient should be called on the UI thread. | 229 // On Chrome OS, PermissionBrokerClient should be called on the UI thread. |
| 240 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner_; | 230 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner_; |
| 241 | 231 |
| 242 std::string port_; | |
| 243 | |
| 244 DISALLOW_COPY_AND_ASSIGN(SerialIoHandler); | 232 DISALLOW_COPY_AND_ASSIGN(SerialIoHandler); |
| 245 }; | 233 }; |
| 246 | 234 |
| 247 } // namespace device | 235 } // namespace device |
| 248 | 236 |
| 249 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ | 237 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ |
| OLD | NEW |