| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 extern const char kSerialConnectionNotFoundError[]; | 22 extern const char kSerialConnectionNotFoundError[]; |
| 23 | 23 |
| 24 class ApiResourceEventNotifier; | 24 class ApiResourceEventNotifier; |
| 25 | 25 |
| 26 // Encapsulates an open serial port. Platform-specific implementations are in | 26 // Encapsulates an open serial port. Platform-specific implementations are in |
| 27 // _win and _posix versions of the the .cc file. | 27 // _win and _posix versions of the the .cc file. |
| 28 class SerialConnection : public ApiResource { | 28 class SerialConnection : public ApiResource { |
| 29 public: | 29 public: |
| 30 SerialConnection(const std::string& port, | 30 SerialConnection(const std::string& port, |
| 31 int bitrate, | 31 int bitrate, |
| 32 const std::string& owner_extension_id, |
| 32 ApiResourceEventNotifier* event_notifier); | 33 ApiResourceEventNotifier* event_notifier); |
| 33 virtual ~SerialConnection(); | 34 virtual ~SerialConnection(); |
| 34 | 35 |
| 35 virtual bool Open(); | 36 virtual bool Open(); |
| 36 virtual void Close(); | 37 virtual void Close(); |
| 37 virtual void Flush(); | 38 virtual void Flush(); |
| 38 | 39 |
| 39 virtual int Read(scoped_refptr<net::IOBufferWithSize> io_buffer); | 40 virtual int Read(scoped_refptr<net::IOBufferWithSize> io_buffer); |
| 40 virtual int Write(scoped_refptr<net::IOBuffer> io_buffer, int byte_count); | 41 virtual int Write(scoped_refptr<net::IOBuffer> io_buffer, int byte_count); |
| 41 | 42 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 std::string port_; | 66 std::string port_; |
| 66 int bitrate_; | 67 int bitrate_; |
| 67 base::PlatformFile file_; | 68 base::PlatformFile file_; |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 } // namespace extensions | 71 } // namespace extensions |
| 71 | 72 |
| 72 #endif // CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_ | 73 #endif // CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_CONNECTION_H_ |
| OLD | NEW |