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/serial/serial_connection.h" | 5 #include "extensions/browser/api/serial/serial_connection.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 SerialConnection::SerialConnection(const std::string& port, | 160 SerialConnection::SerialConnection(const std::string& port, |
161 const std::string& owner_extension_id) | 161 const std::string& owner_extension_id) |
162 : ApiResource(owner_extension_id), | 162 : ApiResource(owner_extension_id), |
163 port_(port), | 163 port_(port), |
164 persistent_(false), | 164 persistent_(false), |
165 buffer_size_(kDefaultBufferSize), | 165 buffer_size_(kDefaultBufferSize), |
166 receive_timeout_(0), | 166 receive_timeout_(0), |
167 send_timeout_(0), | 167 send_timeout_(0), |
168 paused_(false), | 168 paused_(false), |
169 io_handler_(device::SerialIoHandler::Create( | 169 io_handler_(device::SerialIoHandler::Create( |
170 content::BrowserThread::GetMessageLoopProxyForThread( | 170 content::BrowserThread::GetTaskRunnerForThread( |
171 content::BrowserThread::FILE), | 171 content::BrowserThread::FILE), |
172 content::BrowserThread::GetMessageLoopProxyForThread( | 172 content::BrowserThread::GetTaskRunnerForThread( |
173 content::BrowserThread::UI))) { | 173 content::BrowserThread::UI))) { |
174 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 174 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
175 } | 175 } |
176 | 176 |
177 SerialConnection::~SerialConnection() { | 177 SerialConnection::~SerialConnection() { |
178 io_handler_->CancelRead(device::serial::ReceiveError::DISCONNECTED); | 178 io_handler_->CancelRead(device::serial::ReceiveError::DISCONNECTED); |
179 io_handler_->CancelWrite(device::serial::SendError::DISCONNECTED); | 179 io_handler_->CancelWrite(device::serial::SendError::DISCONNECTED); |
180 } | 180 } |
181 | 181 |
182 bool SerialConnection::IsPersistent() const { | 182 bool SerialConnection::IsPersistent() const { |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 output->parity_bit = extensions::ConvertParityBitToMojo(input.parity_bit); | 413 output->parity_bit = extensions::ConvertParityBitToMojo(input.parity_bit); |
414 output->stop_bits = extensions::ConvertStopBitsToMojo(input.stop_bits); | 414 output->stop_bits = extensions::ConvertStopBitsToMojo(input.stop_bits); |
415 if (input.cts_flow_control.get()) { | 415 if (input.cts_flow_control.get()) { |
416 output->has_cts_flow_control = true; | 416 output->has_cts_flow_control = true; |
417 output->cts_flow_control = *input.cts_flow_control; | 417 output->cts_flow_control = *input.cts_flow_control; |
418 } | 418 } |
419 return output; | 419 return output; |
420 } | 420 } |
421 | 421 |
422 } // namespace mojo | 422 } // namespace mojo |
OLD | NEW |