| 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 | 8 |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 } | 394 } |
| 395 | 395 |
| 396 } // namespace extensions | 396 } // namespace extensions |
| 397 | 397 |
| 398 namespace mojo { | 398 namespace mojo { |
| 399 | 399 |
| 400 // static | 400 // static |
| 401 device::serial::HostControlSignalsPtr | 401 device::serial::HostControlSignalsPtr |
| 402 TypeConverter<device::serial::HostControlSignalsPtr, | 402 TypeConverter<device::serial::HostControlSignalsPtr, |
| 403 extensions::core_api::serial::HostControlSignals>:: | 403 extensions::core_api::serial::HostControlSignals>:: |
| 404 ConvertFrom(const extensions::core_api::serial::HostControlSignals& input) { | 404 Convert(const extensions::core_api::serial::HostControlSignals& input) { |
| 405 device::serial::HostControlSignalsPtr output( | 405 device::serial::HostControlSignalsPtr output( |
| 406 device::serial::HostControlSignals::New()); | 406 device::serial::HostControlSignals::New()); |
| 407 if (input.dtr.get()) { | 407 if (input.dtr.get()) { |
| 408 output->has_dtr = true; | 408 output->has_dtr = true; |
| 409 output->dtr = *input.dtr; | 409 output->dtr = *input.dtr; |
| 410 } | 410 } |
| 411 if (input.rts.get()) { | 411 if (input.rts.get()) { |
| 412 output->has_rts = true; | 412 output->has_rts = true; |
| 413 output->rts = *input.rts; | 413 output->rts = *input.rts; |
| 414 } | 414 } |
| 415 return output.Pass(); | 415 return output.Pass(); |
| 416 } | 416 } |
| 417 | 417 |
| 418 // static | 418 // static |
| 419 device::serial::ConnectionOptionsPtr | 419 device::serial::ConnectionOptionsPtr |
| 420 TypeConverter<device::serial::ConnectionOptionsPtr, | 420 TypeConverter<device::serial::ConnectionOptionsPtr, |
| 421 extensions::core_api::serial::ConnectionOptions>:: | 421 extensions::core_api::serial::ConnectionOptions>:: |
| 422 ConvertFrom(const extensions::core_api::serial::ConnectionOptions& input) { | 422 Convert(const extensions::core_api::serial::ConnectionOptions& input) { |
| 423 device::serial::ConnectionOptionsPtr output( | 423 device::serial::ConnectionOptionsPtr output( |
| 424 device::serial::ConnectionOptions::New()); | 424 device::serial::ConnectionOptions::New()); |
| 425 if (input.bitrate.get() && *input.bitrate > 0) | 425 if (input.bitrate.get() && *input.bitrate > 0) |
| 426 output->bitrate = *input.bitrate; | 426 output->bitrate = *input.bitrate; |
| 427 output->data_bits = extensions::ConvertDataBitsToMojo(input.data_bits); | 427 output->data_bits = extensions::ConvertDataBitsToMojo(input.data_bits); |
| 428 output->parity_bit = extensions::ConvertParityBitToMojo(input.parity_bit); | 428 output->parity_bit = extensions::ConvertParityBitToMojo(input.parity_bit); |
| 429 output->stop_bits = extensions::ConvertStopBitsToMojo(input.stop_bits); | 429 output->stop_bits = extensions::ConvertStopBitsToMojo(input.stop_bits); |
| 430 if (input.cts_flow_control.get()) { | 430 if (input.cts_flow_control.get()) { |
| 431 output->has_cts_flow_control = true; | 431 output->has_cts_flow_control = true; |
| 432 output->cts_flow_control = *input.cts_flow_control; | 432 output->cts_flow_control = *input.cts_flow_control; |
| 433 } | 433 } |
| 434 return output.Pass(); | 434 return output.Pass(); |
| 435 } | 435 } |
| 436 | 436 |
| 437 } // namespace mojo | 437 } // namespace mojo |
| OLD | NEW |