Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(509)

Side by Side Diff: extensions/browser/api/serial/serial_connection.cc

Issue 1226353004: Generate all extension schema namespaces as "api" and instead vary the generated bundle names. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "extensions/browser/api/api_resource_manager.h" 14 #include "extensions/browser/api/api_resource_manager.h"
15 #include "extensions/common/api/serial.h" 15 #include "extensions/common/api/serial.h"
16 16
17 namespace extensions { 17 namespace extensions {
18 18
19 namespace { 19 namespace {
20 20
21 const int kDefaultBufferSize = 4096; 21 const int kDefaultBufferSize = 4096;
22 22
23 core_api::serial::SendError ConvertSendErrorFromMojo( 23 api::serial::SendError ConvertSendErrorFromMojo(
24 device::serial::SendError input) { 24 device::serial::SendError input) {
25 switch (input) { 25 switch (input) {
26 case device::serial::SEND_ERROR_NONE: 26 case device::serial::SEND_ERROR_NONE:
27 return core_api::serial::SEND_ERROR_NONE; 27 return api::serial::SEND_ERROR_NONE;
28 case device::serial::SEND_ERROR_DISCONNECTED: 28 case device::serial::SEND_ERROR_DISCONNECTED:
29 return core_api::serial::SEND_ERROR_DISCONNECTED; 29 return api::serial::SEND_ERROR_DISCONNECTED;
30 case device::serial::SEND_ERROR_PENDING: 30 case device::serial::SEND_ERROR_PENDING:
31 return core_api::serial::SEND_ERROR_PENDING; 31 return api::serial::SEND_ERROR_PENDING;
32 case device::serial::SEND_ERROR_TIMEOUT: 32 case device::serial::SEND_ERROR_TIMEOUT:
33 return core_api::serial::SEND_ERROR_TIMEOUT; 33 return api::serial::SEND_ERROR_TIMEOUT;
34 case device::serial::SEND_ERROR_SYSTEM_ERROR: 34 case device::serial::SEND_ERROR_SYSTEM_ERROR:
35 return core_api::serial::SEND_ERROR_SYSTEM_ERROR; 35 return api::serial::SEND_ERROR_SYSTEM_ERROR;
36 } 36 }
37 return core_api::serial::SEND_ERROR_NONE; 37 return api::serial::SEND_ERROR_NONE;
38 } 38 }
39 39
40 core_api::serial::ReceiveError ConvertReceiveErrorFromMojo( 40 api::serial::ReceiveError ConvertReceiveErrorFromMojo(
41 device::serial::ReceiveError input) { 41 device::serial::ReceiveError input) {
42 switch (input) { 42 switch (input) {
43 case device::serial::RECEIVE_ERROR_NONE: 43 case device::serial::RECEIVE_ERROR_NONE:
44 return core_api::serial::RECEIVE_ERROR_NONE; 44 return api::serial::RECEIVE_ERROR_NONE;
45 case device::serial::RECEIVE_ERROR_DISCONNECTED: 45 case device::serial::RECEIVE_ERROR_DISCONNECTED:
46 return core_api::serial::RECEIVE_ERROR_DISCONNECTED; 46 return api::serial::RECEIVE_ERROR_DISCONNECTED;
47 case device::serial::RECEIVE_ERROR_TIMEOUT: 47 case device::serial::RECEIVE_ERROR_TIMEOUT:
48 return core_api::serial::RECEIVE_ERROR_TIMEOUT; 48 return api::serial::RECEIVE_ERROR_TIMEOUT;
49 case device::serial::RECEIVE_ERROR_DEVICE_LOST: 49 case device::serial::RECEIVE_ERROR_DEVICE_LOST:
50 return core_api::serial::RECEIVE_ERROR_DEVICE_LOST; 50 return api::serial::RECEIVE_ERROR_DEVICE_LOST;
51 case device::serial::RECEIVE_ERROR_BREAK: 51 case device::serial::RECEIVE_ERROR_BREAK:
52 return core_api::serial::RECEIVE_ERROR_BREAK; 52 return api::serial::RECEIVE_ERROR_BREAK;
53 case device::serial::RECEIVE_ERROR_FRAME_ERROR: 53 case device::serial::RECEIVE_ERROR_FRAME_ERROR:
54 return core_api::serial::RECEIVE_ERROR_FRAME_ERROR; 54 return api::serial::RECEIVE_ERROR_FRAME_ERROR;
55 case device::serial::RECEIVE_ERROR_OVERRUN: 55 case device::serial::RECEIVE_ERROR_OVERRUN:
56 return core_api::serial::RECEIVE_ERROR_OVERRUN; 56 return api::serial::RECEIVE_ERROR_OVERRUN;
57 case device::serial::RECEIVE_ERROR_BUFFER_OVERFLOW: 57 case device::serial::RECEIVE_ERROR_BUFFER_OVERFLOW:
58 return core_api::serial::RECEIVE_ERROR_BUFFER_OVERFLOW; 58 return api::serial::RECEIVE_ERROR_BUFFER_OVERFLOW;
59 case device::serial::RECEIVE_ERROR_PARITY_ERROR: 59 case device::serial::RECEIVE_ERROR_PARITY_ERROR:
60 return core_api::serial::RECEIVE_ERROR_PARITY_ERROR; 60 return api::serial::RECEIVE_ERROR_PARITY_ERROR;
61 case device::serial::RECEIVE_ERROR_SYSTEM_ERROR: 61 case device::serial::RECEIVE_ERROR_SYSTEM_ERROR:
62 return core_api::serial::RECEIVE_ERROR_SYSTEM_ERROR; 62 return api::serial::RECEIVE_ERROR_SYSTEM_ERROR;
63 } 63 }
64 return core_api::serial::RECEIVE_ERROR_NONE; 64 return api::serial::RECEIVE_ERROR_NONE;
65 } 65 }
66 66
67 core_api::serial::DataBits ConvertDataBitsFromMojo( 67 api::serial::DataBits ConvertDataBitsFromMojo(device::serial::DataBits input) {
68 device::serial::DataBits input) {
69 switch (input) { 68 switch (input) {
70 case device::serial::DATA_BITS_NONE: 69 case device::serial::DATA_BITS_NONE:
71 return core_api::serial::DATA_BITS_NONE; 70 return api::serial::DATA_BITS_NONE;
72 case device::serial::DATA_BITS_SEVEN: 71 case device::serial::DATA_BITS_SEVEN:
73 return core_api::serial::DATA_BITS_SEVEN; 72 return api::serial::DATA_BITS_SEVEN;
74 case device::serial::DATA_BITS_EIGHT: 73 case device::serial::DATA_BITS_EIGHT:
75 return core_api::serial::DATA_BITS_EIGHT; 74 return api::serial::DATA_BITS_EIGHT;
76 } 75 }
77 return core_api::serial::DATA_BITS_NONE; 76 return api::serial::DATA_BITS_NONE;
78 } 77 }
79 78
80 device::serial::DataBits ConvertDataBitsToMojo( 79 device::serial::DataBits ConvertDataBitsToMojo(api::serial::DataBits input) {
81 core_api::serial::DataBits input) {
82 switch (input) { 80 switch (input) {
83 case core_api::serial::DATA_BITS_NONE: 81 case api::serial::DATA_BITS_NONE:
84 return device::serial::DATA_BITS_NONE; 82 return device::serial::DATA_BITS_NONE;
85 case core_api::serial::DATA_BITS_SEVEN: 83 case api::serial::DATA_BITS_SEVEN:
86 return device::serial::DATA_BITS_SEVEN; 84 return device::serial::DATA_BITS_SEVEN;
87 case core_api::serial::DATA_BITS_EIGHT: 85 case api::serial::DATA_BITS_EIGHT:
88 return device::serial::DATA_BITS_EIGHT; 86 return device::serial::DATA_BITS_EIGHT;
89 } 87 }
90 return device::serial::DATA_BITS_NONE; 88 return device::serial::DATA_BITS_NONE;
91 } 89 }
92 90
93 core_api::serial::ParityBit ConvertParityBitFromMojo( 91 api::serial::ParityBit ConvertParityBitFromMojo(
94 device::serial::ParityBit input) { 92 device::serial::ParityBit input) {
95 switch (input) { 93 switch (input) {
96 case device::serial::PARITY_BIT_NONE: 94 case device::serial::PARITY_BIT_NONE:
97 return core_api::serial::PARITY_BIT_NONE; 95 return api::serial::PARITY_BIT_NONE;
98 case device::serial::PARITY_BIT_ODD: 96 case device::serial::PARITY_BIT_ODD:
99 return core_api::serial::PARITY_BIT_ODD; 97 return api::serial::PARITY_BIT_ODD;
100 case device::serial::PARITY_BIT_NO: 98 case device::serial::PARITY_BIT_NO:
101 return core_api::serial::PARITY_BIT_NO; 99 return api::serial::PARITY_BIT_NO;
102 case device::serial::PARITY_BIT_EVEN: 100 case device::serial::PARITY_BIT_EVEN:
103 return core_api::serial::PARITY_BIT_EVEN; 101 return api::serial::PARITY_BIT_EVEN;
104 } 102 }
105 return core_api::serial::PARITY_BIT_NONE; 103 return api::serial::PARITY_BIT_NONE;
106 } 104 }
107 105
108 device::serial::ParityBit ConvertParityBitToMojo( 106 device::serial::ParityBit ConvertParityBitToMojo(api::serial::ParityBit input) {
109 core_api::serial::ParityBit input) {
110 switch (input) { 107 switch (input) {
111 case core_api::serial::PARITY_BIT_NONE: 108 case api::serial::PARITY_BIT_NONE:
112 return device::serial::PARITY_BIT_NONE; 109 return device::serial::PARITY_BIT_NONE;
113 case core_api::serial::PARITY_BIT_NO: 110 case api::serial::PARITY_BIT_NO:
114 return device::serial::PARITY_BIT_NO; 111 return device::serial::PARITY_BIT_NO;
115 case core_api::serial::PARITY_BIT_ODD: 112 case api::serial::PARITY_BIT_ODD:
116 return device::serial::PARITY_BIT_ODD; 113 return device::serial::PARITY_BIT_ODD;
117 case core_api::serial::PARITY_BIT_EVEN: 114 case api::serial::PARITY_BIT_EVEN:
118 return device::serial::PARITY_BIT_EVEN; 115 return device::serial::PARITY_BIT_EVEN;
119 } 116 }
120 return device::serial::PARITY_BIT_NONE; 117 return device::serial::PARITY_BIT_NONE;
121 } 118 }
122 119
123 core_api::serial::StopBits ConvertStopBitsFromMojo( 120 api::serial::StopBits ConvertStopBitsFromMojo(device::serial::StopBits input) {
124 device::serial::StopBits input) {
125 switch (input) { 121 switch (input) {
126 case device::serial::STOP_BITS_NONE: 122 case device::serial::STOP_BITS_NONE:
127 return core_api::serial::STOP_BITS_NONE; 123 return api::serial::STOP_BITS_NONE;
128 case device::serial::STOP_BITS_ONE: 124 case device::serial::STOP_BITS_ONE:
129 return core_api::serial::STOP_BITS_ONE; 125 return api::serial::STOP_BITS_ONE;
130 case device::serial::STOP_BITS_TWO: 126 case device::serial::STOP_BITS_TWO:
131 return core_api::serial::STOP_BITS_TWO; 127 return api::serial::STOP_BITS_TWO;
132 } 128 }
133 return core_api::serial::STOP_BITS_NONE; 129 return api::serial::STOP_BITS_NONE;
134 } 130 }
135 131
136 device::serial::StopBits ConvertStopBitsToMojo( 132 device::serial::StopBits ConvertStopBitsToMojo(api::serial::StopBits input) {
137 core_api::serial::StopBits input) {
138 switch (input) { 133 switch (input) {
139 case core_api::serial::STOP_BITS_NONE: 134 case api::serial::STOP_BITS_NONE:
140 return device::serial::STOP_BITS_NONE; 135 return device::serial::STOP_BITS_NONE;
141 case core_api::serial::STOP_BITS_ONE: 136 case api::serial::STOP_BITS_ONE:
142 return device::serial::STOP_BITS_ONE; 137 return device::serial::STOP_BITS_ONE;
143 case core_api::serial::STOP_BITS_TWO: 138 case api::serial::STOP_BITS_TWO:
144 return device::serial::STOP_BITS_TWO; 139 return device::serial::STOP_BITS_TWO;
145 } 140 }
146 return device::serial::STOP_BITS_NONE; 141 return device::serial::STOP_BITS_NONE;
147 } 142 }
148 143
149 class SendBuffer : public device::ReadOnlyBuffer { 144 class SendBuffer : public device::ReadOnlyBuffer {
150 public: 145 public:
151 SendBuffer( 146 SendBuffer(
152 const std::vector<char>& data, 147 const std::vector<char>& data,
153 const base::Callback<void(int, device::serial::SendError)>& callback) 148 const base::Callback<void(int, device::serial::SendError)>& callback)
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 send_timeout_ = send_timeout; 237 send_timeout_ = send_timeout;
243 } 238 }
244 239
245 void SerialConnection::set_paused(bool paused) { 240 void SerialConnection::set_paused(bool paused) {
246 paused_ = paused; 241 paused_ = paused;
247 if (paused) { 242 if (paused) {
248 io_handler_->CancelRead(device::serial::RECEIVE_ERROR_NONE); 243 io_handler_->CancelRead(device::serial::RECEIVE_ERROR_NONE);
249 } 244 }
250 } 245 }
251 246
252 void SerialConnection::Open(const core_api::serial::ConnectionOptions& options, 247 void SerialConnection::Open(const api::serial::ConnectionOptions& options,
253 const OpenCompleteCallback& callback) { 248 const OpenCompleteCallback& callback) {
254 DCHECK_CURRENTLY_ON(BrowserThread::IO); 249 DCHECK_CURRENTLY_ON(BrowserThread::IO);
255 if (options.persistent.get()) 250 if (options.persistent.get())
256 set_persistent(*options.persistent); 251 set_persistent(*options.persistent);
257 if (options.name.get()) 252 if (options.name.get())
258 set_name(*options.name); 253 set_name(*options.name);
259 if (options.buffer_size.get()) 254 if (options.buffer_size.get())
260 set_buffer_size(*options.buffer_size); 255 set_buffer_size(*options.buffer_size);
261 if (options.receive_timeout.get()) 256 if (options.receive_timeout.get())
262 set_receive_timeout(*options.receive_timeout); 257 set_receive_timeout(*options.receive_timeout);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 send_timeout_task_.reset(); 291 send_timeout_task_.reset();
297 if (send_timeout_ > 0) { 292 if (send_timeout_ > 0) {
298 send_timeout_task_.reset(new TimeoutTask( 293 send_timeout_task_.reset(new TimeoutTask(
299 base::Bind(&SerialConnection::OnSendTimeout, AsWeakPtr()), 294 base::Bind(&SerialConnection::OnSendTimeout, AsWeakPtr()),
300 base::TimeDelta::FromMilliseconds(send_timeout_))); 295 base::TimeDelta::FromMilliseconds(send_timeout_)));
301 } 296 }
302 return true; 297 return true;
303 } 298 }
304 299
305 bool SerialConnection::Configure( 300 bool SerialConnection::Configure(
306 const core_api::serial::ConnectionOptions& options) { 301 const api::serial::ConnectionOptions& options) {
307 DCHECK_CURRENTLY_ON(BrowserThread::IO); 302 DCHECK_CURRENTLY_ON(BrowserThread::IO);
308 if (options.persistent.get()) 303 if (options.persistent.get())
309 set_persistent(*options.persistent); 304 set_persistent(*options.persistent);
310 if (options.name.get()) 305 if (options.name.get())
311 set_name(*options.name); 306 set_name(*options.name);
312 if (options.buffer_size.get()) 307 if (options.buffer_size.get())
313 set_buffer_size(*options.buffer_size); 308 set_buffer_size(*options.buffer_size);
314 if (options.receive_timeout.get()) 309 if (options.receive_timeout.get())
315 set_receive_timeout(*options.receive_timeout); 310 set_receive_timeout(*options.receive_timeout);
316 if (options.send_timeout.get()) 311 if (options.send_timeout.get())
317 set_send_timeout(*options.send_timeout); 312 set_send_timeout(*options.send_timeout);
318 bool success = io_handler_->ConfigurePort( 313 bool success = io_handler_->ConfigurePort(
319 *device::serial::ConnectionOptions::From(options)); 314 *device::serial::ConnectionOptions::From(options));
320 io_handler_->CancelRead(device::serial::RECEIVE_ERROR_NONE); 315 io_handler_->CancelRead(device::serial::RECEIVE_ERROR_NONE);
321 return success; 316 return success;
322 } 317 }
323 318
324 void SerialConnection::SetIoHandlerForTest( 319 void SerialConnection::SetIoHandlerForTest(
325 scoped_refptr<device::SerialIoHandler> handler) { 320 scoped_refptr<device::SerialIoHandler> handler) {
326 io_handler_ = handler; 321 io_handler_ = handler;
327 } 322 }
328 323
329 bool SerialConnection::GetInfo(core_api::serial::ConnectionInfo* info) const { 324 bool SerialConnection::GetInfo(api::serial::ConnectionInfo* info) const {
330 DCHECK_CURRENTLY_ON(BrowserThread::IO); 325 DCHECK_CURRENTLY_ON(BrowserThread::IO);
331 info->paused = paused_; 326 info->paused = paused_;
332 info->persistent = persistent_; 327 info->persistent = persistent_;
333 info->name = name_; 328 info->name = name_;
334 info->buffer_size = buffer_size_; 329 info->buffer_size = buffer_size_;
335 info->receive_timeout = receive_timeout_; 330 info->receive_timeout = receive_timeout_;
336 info->send_timeout = send_timeout_; 331 info->send_timeout = send_timeout_;
337 device::serial::ConnectionInfoPtr port_info = io_handler_->GetPortInfo(); 332 device::serial::ConnectionInfoPtr port_info = io_handler_->GetPortInfo();
338 if (!port_info) 333 if (!port_info)
339 return false; 334 return false;
340 335
341 info->bitrate.reset(new int(port_info->bitrate)); 336 info->bitrate.reset(new int(port_info->bitrate));
342 info->data_bits = ConvertDataBitsFromMojo(port_info->data_bits); 337 info->data_bits = ConvertDataBitsFromMojo(port_info->data_bits);
343 info->parity_bit = ConvertParityBitFromMojo(port_info->parity_bit); 338 info->parity_bit = ConvertParityBitFromMojo(port_info->parity_bit);
344 info->stop_bits = ConvertStopBitsFromMojo(port_info->stop_bits); 339 info->stop_bits = ConvertStopBitsFromMojo(port_info->stop_bits);
345 info->cts_flow_control.reset(new bool(port_info->cts_flow_control)); 340 info->cts_flow_control.reset(new bool(port_info->cts_flow_control));
346 return true; 341 return true;
347 } 342 }
348 343
349 bool SerialConnection::Flush() const { 344 bool SerialConnection::Flush() const {
350 return io_handler_->Flush(); 345 return io_handler_->Flush();
351 } 346 }
352 347
353 bool SerialConnection::GetControlSignals( 348 bool SerialConnection::GetControlSignals(
354 core_api::serial::DeviceControlSignals* control_signals) const { 349 api::serial::DeviceControlSignals* control_signals) const {
355 device::serial::DeviceControlSignalsPtr signals = 350 device::serial::DeviceControlSignalsPtr signals =
356 io_handler_->GetControlSignals(); 351 io_handler_->GetControlSignals();
357 if (!signals) 352 if (!signals)
358 return false; 353 return false;
359 354
360 control_signals->dcd = signals->dcd; 355 control_signals->dcd = signals->dcd;
361 control_signals->cts = signals->cts; 356 control_signals->cts = signals->cts;
362 control_signals->ri = signals->ri; 357 control_signals->ri = signals->ri;
363 control_signals->dsr = signals->dsr; 358 control_signals->dsr = signals->dsr;
364 return true; 359 return true;
365 } 360 }
366 361
367 bool SerialConnection::SetControlSignals( 362 bool SerialConnection::SetControlSignals(
368 const core_api::serial::HostControlSignals& control_signals) { 363 const api::serial::HostControlSignals& control_signals) {
369 return io_handler_->SetControlSignals( 364 return io_handler_->SetControlSignals(
370 *device::serial::HostControlSignals::From(control_signals)); 365 *device::serial::HostControlSignals::From(control_signals));
371 } 366 }
372 367
373 bool SerialConnection::SetBreak() { 368 bool SerialConnection::SetBreak() {
374 return io_handler_->SetBreak(); 369 return io_handler_->SetBreak();
375 } 370 }
376 371
377 bool SerialConnection::ClearBreak() { 372 bool SerialConnection::ClearBreak() {
378 return io_handler_->ClearBreak(); 373 return io_handler_->ClearBreak();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 closure_.Run(); 422 closure_.Run();
428 } 423 }
429 424
430 } // namespace extensions 425 } // namespace extensions
431 426
432 namespace mojo { 427 namespace mojo {
433 428
434 // static 429 // static
435 device::serial::HostControlSignalsPtr 430 device::serial::HostControlSignalsPtr
436 TypeConverter<device::serial::HostControlSignalsPtr, 431 TypeConverter<device::serial::HostControlSignalsPtr,
437 extensions::core_api::serial::HostControlSignals>:: 432 extensions::api::serial::HostControlSignals>::
438 Convert(const extensions::core_api::serial::HostControlSignals& input) { 433 Convert(const extensions::api::serial::HostControlSignals& input) {
439 device::serial::HostControlSignalsPtr output( 434 device::serial::HostControlSignalsPtr output(
440 device::serial::HostControlSignals::New()); 435 device::serial::HostControlSignals::New());
441 if (input.dtr.get()) { 436 if (input.dtr.get()) {
442 output->has_dtr = true; 437 output->has_dtr = true;
443 output->dtr = *input.dtr; 438 output->dtr = *input.dtr;
444 } 439 }
445 if (input.rts.get()) { 440 if (input.rts.get()) {
446 output->has_rts = true; 441 output->has_rts = true;
447 output->rts = *input.rts; 442 output->rts = *input.rts;
448 } 443 }
449 return output.Pass(); 444 return output.Pass();
450 } 445 }
451 446
452 // static 447 // static
453 device::serial::ConnectionOptionsPtr 448 device::serial::ConnectionOptionsPtr
454 TypeConverter<device::serial::ConnectionOptionsPtr, 449 TypeConverter<device::serial::ConnectionOptionsPtr,
455 extensions::core_api::serial::ConnectionOptions>:: 450 extensions::api::serial::ConnectionOptions>::
456 Convert(const extensions::core_api::serial::ConnectionOptions& input) { 451 Convert(const extensions::api::serial::ConnectionOptions& input) {
457 device::serial::ConnectionOptionsPtr output( 452 device::serial::ConnectionOptionsPtr output(
458 device::serial::ConnectionOptions::New()); 453 device::serial::ConnectionOptions::New());
459 if (input.bitrate.get() && *input.bitrate > 0) 454 if (input.bitrate.get() && *input.bitrate > 0)
460 output->bitrate = *input.bitrate; 455 output->bitrate = *input.bitrate;
461 output->data_bits = extensions::ConvertDataBitsToMojo(input.data_bits); 456 output->data_bits = extensions::ConvertDataBitsToMojo(input.data_bits);
462 output->parity_bit = extensions::ConvertParityBitToMojo(input.parity_bit); 457 output->parity_bit = extensions::ConvertParityBitToMojo(input.parity_bit);
463 output->stop_bits = extensions::ConvertStopBitsToMojo(input.stop_bits); 458 output->stop_bits = extensions::ConvertStopBitsToMojo(input.stop_bits);
464 if (input.cts_flow_control.get()) { 459 if (input.cts_flow_control.get()) {
465 output->has_cts_flow_control = true; 460 output->has_cts_flow_control = true;
466 output->cts_flow_control = *input.cts_flow_control; 461 output->cts_flow_control = *input.cts_flow_control;
467 } 462 }
468 return output.Pass(); 463 return output.Pass();
469 } 464 }
470 465
471 } // namespace mojo 466 } // namespace mojo
OLDNEW
« no previous file with comments | « extensions/browser/api/serial/serial_connection.h ('k') | extensions/browser/api/serial/serial_event_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698