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 #ifndef DEVICE_SERIAL_SERIAL_CONNECTION_FACTORY_H_ | 5 #ifndef DEVICE_SERIAL_SERIAL_CONNECTION_FACTORY_H_ |
6 #define DEVICE_SERIAL_SERIAL_CONNECTION_FACTORY_H_ | 6 #define DEVICE_SERIAL_SERIAL_CONNECTION_FACTORY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/message_loop/message_loop_proxy.h" | 12 #include "base/message_loop/message_loop_proxy.h" |
| 13 #include "device/serial/data_stream.mojom.h" |
13 #include "device/serial/serial.mojom.h" | 14 #include "device/serial/serial.mojom.h" |
14 #include "mojo/public/cpp/bindings/interface_request.h" | 15 #include "mojo/public/cpp/bindings/interface_request.h" |
15 | 16 |
16 namespace device { | 17 namespace device { |
17 | 18 |
18 class SerialIoHandler; | 19 class SerialIoHandler; |
19 | 20 |
20 class SerialConnectionFactory | 21 class SerialConnectionFactory |
21 : public base::RefCountedThreadSafe<SerialConnectionFactory> { | 22 : public base::RefCountedThreadSafe<SerialConnectionFactory> { |
22 public: | 23 public: |
23 typedef base::Callback<scoped_refptr<SerialIoHandler>()> IoHandlerFactory; | 24 typedef base::Callback<scoped_refptr<SerialIoHandler>()> IoHandlerFactory; |
24 | 25 |
25 SerialConnectionFactory( | 26 SerialConnectionFactory( |
26 const IoHandlerFactory& io_handler_factory, | 27 const IoHandlerFactory& io_handler_factory, |
27 scoped_refptr<base::MessageLoopProxy> connect_message_loop); | 28 scoped_refptr<base::MessageLoopProxy> connect_message_loop); |
28 | 29 |
29 void CreateConnection( | 30 void CreateConnection( |
30 const std::string& path, | 31 const std::string& path, |
31 serial::ConnectionOptionsPtr options, | 32 serial::ConnectionOptionsPtr options, |
32 mojo::InterfaceRequest<serial::Connection> connection_request); | 33 mojo::InterfaceRequest<serial::Connection> connection_request, |
| 34 mojo::InterfaceRequest<serial::DataSink> sink, |
| 35 mojo::InterfaceRequest<serial::DataSource> source); |
33 | 36 |
34 private: | 37 private: |
35 friend class base::RefCountedThreadSafe<SerialConnectionFactory>; | 38 friend class base::RefCountedThreadSafe<SerialConnectionFactory>; |
36 class ConnectTask; | 39 class ConnectTask; |
37 | 40 |
38 virtual ~SerialConnectionFactory(); | 41 virtual ~SerialConnectionFactory(); |
39 | 42 |
40 const IoHandlerFactory io_handler_factory_; | 43 const IoHandlerFactory io_handler_factory_; |
41 scoped_refptr<base::MessageLoopProxy> connect_message_loop_; | 44 scoped_refptr<base::MessageLoopProxy> connect_message_loop_; |
42 | 45 |
43 DISALLOW_COPY_AND_ASSIGN(SerialConnectionFactory); | 46 DISALLOW_COPY_AND_ASSIGN(SerialConnectionFactory); |
44 }; | 47 }; |
45 | 48 |
46 } // namespace device | 49 } // namespace device |
47 | 50 |
48 #endif // DEVICE_SERIAL_SERIAL_CONNECTION_FACTORY_H_ | 51 #endif // DEVICE_SERIAL_SERIAL_CONNECTION_FACTORY_H_ |
OLD | NEW |