| 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_SERVICE_IMPL_H_ | 5 #ifndef DEVICE_SERIAL_SERIAL_SERVICE_IMPL_H_ |
| 6 #define DEVICE_SERIAL_SERIAL_SERVICE_IMPL_H_ | 6 #define DEVICE_SERIAL_SERIAL_SERVICE_IMPL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 static void Create(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 30 static void Create(scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 31 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 31 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 32 mojo::InterfaceRequest<serial::SerialService> request); | 32 mojo::InterfaceRequest<serial::SerialService> request); |
| 33 static void CreateOnMessageLoop( | 33 static void CreateOnMessageLoop( |
| 34 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 34 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
| 35 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, | 35 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner, |
| 36 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, | 36 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner, |
| 37 mojo::InterfaceRequest<serial::SerialService> request); | 37 mojo::InterfaceRequest<serial::SerialService> request); |
| 38 | 38 |
| 39 // SerialService overrides. | 39 // SerialService overrides. |
| 40 void GetDevices(const GetDevicesCallback& callback) override; | 40 void GetDevices( |
| 41 const mojo::Callback<void(mojo::Array<serial::DeviceInfoPtr>)>& callback) |
| 42 override; |
| 41 void Connect( | 43 void Connect( |
| 42 const mojo::String& path, | 44 const mojo::String& path, |
| 43 serial::ConnectionOptionsPtr options, | 45 serial::ConnectionOptionsPtr options, |
| 44 mojo::InterfaceRequest<serial::Connection> connection_request, | 46 mojo::InterfaceRequest<serial::Connection> connection_request, |
| 45 mojo::InterfaceRequest<serial::DataSink> sink, | 47 mojo::InterfaceRequest<serial::DataSink> sink, |
| 46 mojo::InterfaceRequest<serial::DataSource> source, | 48 mojo::InterfaceRequest<serial::DataSource> source, |
| 47 mojo::InterfacePtr<serial::DataSourceClient> source_client) override; | 49 mojo::InterfacePtr<serial::DataSourceClient> source_client) override; |
| 48 | 50 |
| 49 private: | 51 private: |
| 50 SerialDeviceEnumerator* GetDeviceEnumerator(); | 52 SerialDeviceEnumerator* GetDeviceEnumerator(); |
| 51 bool IsValidPath(const mojo::String& path); | 53 bool IsValidPath(const mojo::String& path); |
| 52 | 54 |
| 53 std::unique_ptr<SerialDeviceEnumerator> device_enumerator_; | 55 std::unique_ptr<SerialDeviceEnumerator> device_enumerator_; |
| 54 scoped_refptr<SerialConnectionFactory> connection_factory_; | 56 scoped_refptr<SerialConnectionFactory> connection_factory_; |
| 55 mojo::StrongBinding<serial::SerialService> binding_; | 57 mojo::StrongBinding<serial::SerialService> binding_; |
| 56 | 58 |
| 57 DISALLOW_COPY_AND_ASSIGN(SerialServiceImpl); | 59 DISALLOW_COPY_AND_ASSIGN(SerialServiceImpl); |
| 58 }; | 60 }; |
| 59 | 61 |
| 60 } // namespace device | 62 } // namespace device |
| 61 | 63 |
| 62 #endif // DEVICE_SERIAL_SERIAL_SERVICE_IMPL_H_ | 64 #endif // DEVICE_SERIAL_SERIAL_SERVICE_IMPL_H_ |
| OLD | NEW |