Vectorize website settings icons in omnibox
[chromium-blink-merge.git] / device / serial / serial_connection.h
blob22f48bfeedb474070732400bf0f891dfbccff770
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
3 // found in the LICENSE file.
5 #ifndef DEVICE_SERIAL_SERIAL_CONNECTION_H_
6 #define DEVICE_SERIAL_SERIAL_CONNECTION_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "device/serial/serial.mojom.h"
11 #include "third_party/mojo/src/mojo/public/cpp/bindings/strong_binding.h"
13 namespace device {
15 class DataSinkReceiver;
16 class DataSourceSender;
17 class ReadOnlyBuffer;
18 class SerialIoHandler;
19 class WritableBuffer;
21 class SerialConnection : public serial::Connection {
22 public:
23 SerialConnection(scoped_refptr<SerialIoHandler> io_handler,
24 mojo::InterfaceRequest<serial::DataSink> sink,
25 mojo::InterfaceRequest<serial::DataSource> source,
26 mojo::InterfacePtr<serial::DataSourceClient> source_client,
27 mojo::InterfaceRequest<serial::Connection> request);
28 ~SerialConnection() override;
30 // serial::Connection overrides.
31 void GetInfo(
32 const mojo::Callback<void(serial::ConnectionInfoPtr)>& callback) override;
33 void SetOptions(serial::ConnectionOptionsPtr options,
34 const mojo::Callback<void(bool)>& callback) override;
35 void SetControlSignals(serial::HostControlSignalsPtr signals,
36 const mojo::Callback<void(bool)>& callback) override;
37 void GetControlSignals(
38 const mojo::Callback<void(serial::DeviceControlSignalsPtr)>& callback)
39 override;
40 void Flush(const mojo::Callback<void(bool)>& callback) override;
42 private:
43 void OnSendPipeReady(scoped_ptr<ReadOnlyBuffer> buffer);
44 void OnSendCancelled(int32_t error);
45 void OnReceivePipeReady(scoped_ptr<WritableBuffer> buffer);
47 scoped_refptr<SerialIoHandler> io_handler_;
48 scoped_refptr<DataSinkReceiver> receiver_;
49 scoped_refptr<DataSourceSender> sender_;
51 mojo::StrongBinding<serial::Connection> binding_;
53 DISALLOW_COPY_AND_ASSIGN(SerialConnection);
56 } // namespace device
58 #endif // DEVICE_SERIAL_SERIAL_CONNECTION_H_