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 |
193 private: | 203 private: |
194 friend class base::RefCounted<SerialIoHandler>; | 204 friend class base::RefCounted<SerialIoHandler>; |
195 | 205 |
196 void MergeConnectionOptions(const serial::ConnectionOptions& options); | 206 void MergeConnectionOptions(const serial::ConnectionOptions& options); |
197 | 207 |
198 // Continues an Open operation on the FILE thread. | 208 // Continues an Open operation on the FILE thread. |
199 void StartOpen(const std::string& port, | 209 void StartOpen(const std::string& port, |
200 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); | 210 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner); |
201 | 211 |
202 // Finalizes an Open operation (continued from StartOpen) on the IO thread. | 212 // Finalizes an Open operation (continued from StartOpen) on the IO thread. |
(...skipping 19 matching lines...) Expand all Loading... |
222 serial::SendError write_cancel_reason_; | 232 serial::SendError write_cancel_reason_; |
223 bool write_canceled_; | 233 bool write_canceled_; |
224 | 234 |
225 // Callback to handle the completion of a pending Open() request. | 235 // Callback to handle the completion of a pending Open() request. |
226 OpenCompleteCallback open_complete_; | 236 OpenCompleteCallback open_complete_; |
227 | 237 |
228 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; | 238 scoped_refptr<base::SingleThreadTaskRunner> file_thread_task_runner_; |
229 // On Chrome OS, PermissionBrokerClient should be called on the UI thread. | 239 // On Chrome OS, PermissionBrokerClient should be called on the UI thread. |
230 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner_; | 240 scoped_refptr<base::SingleThreadTaskRunner> ui_thread_task_runner_; |
231 | 241 |
| 242 std::string port_; |
| 243 |
232 DISALLOW_COPY_AND_ASSIGN(SerialIoHandler); | 244 DISALLOW_COPY_AND_ASSIGN(SerialIoHandler); |
233 }; | 245 }; |
234 | 246 |
235 } // namespace device | 247 } // namespace device |
236 | 248 |
237 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ | 249 #endif // DEVICE_SERIAL_SERIAL_IO_HANDLER_H_ |
OLD | NEW |