| Index: chrome/browser/extensions/api/serial/serial_io_handler.h
|
| diff --git a/chrome/browser/extensions/api/serial/serial_io_handler.h b/chrome/browser/extensions/api/serial/serial_io_handler.h
|
| index 8784afb8a990be26bd5f60cbc1c3cccf19ff1aa5..6260bdcc7b660d964c5e29da3a498034befb6003 100644
|
| --- a/chrome/browser/extensions/api/serial/serial_io_handler.h
|
| +++ b/chrome/browser/extensions/api/serial/serial_io_handler.h
|
| @@ -9,7 +9,7 @@
|
| #include "base/files/file.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/threading/non_thread_safe.h"
|
| -#include "chrome/common/extensions/api/serial.h"
|
| +#include "device/serial/serial.mojom.h"
|
| #include "net/base/io_buffer.h"
|
|
|
| namespace extensions {
|
| @@ -29,12 +29,11 @@ class SerialIoHandler : public base::NonThreadSafe,
|
| // Called with a string of bytes read, and a result code. Note that an error
|
| // result does not necessarily imply 0 bytes read.
|
| typedef base::Callback<void(const std::string& data,
|
| - api::serial::ReceiveError error)>
|
| - ReadCompleteCallback;
|
| + device::ReceiveError error)> ReadCompleteCallback;
|
|
|
| // Called with the number of bytes written and a result code. Note that an
|
| // error result does not necessarily imply 0 bytes written.
|
| - typedef base::Callback<void(int bytes_written, api::serial::SendError error)>
|
| + typedef base::Callback<void(int bytes_written, device::SendError error)>
|
| WriteCompleteCallback;
|
|
|
| // Initializes the handler on the current message loop. Must be called exactly
|
| @@ -63,10 +62,10 @@ class SerialIoHandler : public base::NonThreadSafe,
|
| bool IsWritePending() const;
|
|
|
| // Attempts to cancel a pending read operation.
|
| - void CancelRead(api::serial::ReceiveError reason);
|
| + void CancelRead(device::ReceiveError reason);
|
|
|
| // Attempts to cancel a pending write operation.
|
| - void CancelWrite(api::serial::SendError reason);
|
| + void CancelWrite(device::SendError reason);
|
|
|
| // Flushes input and output buffers.
|
| virtual bool Flush() const = 0;
|
| @@ -74,23 +73,22 @@ class SerialIoHandler : public base::NonThreadSafe,
|
| // Reads current control signals (DCD, CTS, etc.) into an existing
|
| // DeviceControlSignals structure. Returns |true| iff the signals were
|
| // successfully read.
|
| - virtual bool GetControlSignals(
|
| - api::serial::DeviceControlSignals* control_signals) const = 0;
|
| + virtual device::DeviceControlSignalsPtr GetControlSignals() const = 0;
|
|
|
| // Sets one or more control signals (DTR and/or RTS). Returns |true| iff
|
| // the signals were successfully set. Unininitialized flags in the
|
| // HostControlSignals structure are left unchanged.
|
| virtual bool SetControlSignals(
|
| - const api::serial::HostControlSignals& control_signals) = 0;
|
| + const device::HostControlSignals& control_signals) = 0;
|
|
|
| // Performs platform-specific port configuration. Returns |true| iff
|
| // configuration was successful.
|
| - virtual bool ConfigurePort(const api::serial::ConnectionOptions& options) = 0;
|
| + virtual bool ConfigurePort(const device::ConnectionOptions& options) = 0;
|
|
|
| // Performs a platform-specific port configuration query. Fills values in an
|
| // existing ConnectionInfo. Returns |true| iff port configuration was
|
| // successfully retrieved.
|
| - virtual bool GetPortInfo(api::serial::ConnectionInfo* info) const = 0;
|
| + virtual device::ConnectionInfoPtr GetPortInfo() const = 0;
|
|
|
| protected:
|
| SerialIoHandler();
|
| @@ -122,22 +120,22 @@ class SerialIoHandler : public base::NonThreadSafe,
|
| // Called by the implementation to signal that the active read has completed.
|
| // WARNING: Calling this method can destroy the SerialIoHandler instance
|
| // if the associated I/O operation was the only thing keeping it alive.
|
| - void ReadCompleted(int bytes_read, api::serial::ReceiveError error);
|
| + void ReadCompleted(int bytes_read, device::ReceiveError error);
|
|
|
| // Called by the implementation to signal that the active write has completed.
|
| // WARNING: Calling this method may destroy the SerialIoHandler instance
|
| // if the associated I/O operation was the only thing keeping it alive.
|
| - void WriteCompleted(int bytes_written, api::serial::SendError error);
|
| + void WriteCompleted(int bytes_written, device::SendError error);
|
|
|
| // Queues a ReadCompleted call on the current thread. This is used to allow
|
| // ReadImpl to immediately signal completion with 0 bytes and an error,
|
| // without being reentrant.
|
| - void QueueReadCompleted(int bytes_read, api::serial::ReceiveError error);
|
| + void QueueReadCompleted(int bytes_read, device::ReceiveError error);
|
|
|
| // Queues a WriteCompleted call on the current thread. This is used to allow
|
| // WriteImpl to immediately signal completion with 0 bytes and an error,
|
| // without being reentrant.
|
| - void QueueWriteCompleted(int bytes_written, api::serial::SendError error);
|
| + void QueueWriteCompleted(int bytes_written, device::SendError error);
|
|
|
| const base::File& file() const { return file_; }
|
|
|
| @@ -149,7 +147,7 @@ class SerialIoHandler : public base::NonThreadSafe,
|
| return pending_read_buffer_len_;
|
| }
|
|
|
| - api::serial::ReceiveError read_cancel_reason() const {
|
| + device::ReceiveError read_cancel_reason() const {
|
| return read_cancel_reason_;
|
| }
|
|
|
| @@ -165,9 +163,7 @@ class SerialIoHandler : public base::NonThreadSafe,
|
| return pending_write_buffer_len_;
|
| }
|
|
|
| - api::serial::SendError write_cancel_reason() const {
|
| - return write_cancel_reason_;
|
| - }
|
| + device::SendError write_cancel_reason() const { return write_cancel_reason_; }
|
|
|
| bool write_canceled() const {
|
| return write_canceled_;
|
| @@ -196,12 +192,12 @@ class SerialIoHandler : public base::NonThreadSafe,
|
|
|
| scoped_refptr<net::IOBuffer> pending_read_buffer_;
|
| int pending_read_buffer_len_;
|
| - api::serial::ReceiveError read_cancel_reason_;
|
| + device::ReceiveError read_cancel_reason_;
|
| bool read_canceled_;
|
|
|
| scoped_refptr<net::IOBuffer> pending_write_buffer_;
|
| int pending_write_buffer_len_;
|
| - api::serial::SendError write_cancel_reason_;
|
| + device::SendError write_cancel_reason_;
|
| bool write_canceled_;
|
|
|
| ReadCompleteCallback read_complete_;
|
|
|