| 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_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_API_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 protected: | 42 protected: |
| 43 virtual ~SerialOpenFunction() {} | 43 virtual ~SerialOpenFunction() {} |
| 44 | 44 |
| 45 // AsyncAPIFunction: | 45 // AsyncAPIFunction: |
| 46 virtual bool Prepare() OVERRIDE; | 46 virtual bool Prepare() OVERRIDE; |
| 47 virtual void AsyncWorkStart() OVERRIDE; | 47 virtual void AsyncWorkStart() OVERRIDE; |
| 48 virtual void Work() OVERRIDE; | 48 virtual void Work() OVERRIDE; |
| 49 virtual bool Respond() OVERRIDE; | 49 virtual bool Respond() OVERRIDE; |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 void OpenPortOnIOThread(); | |
| 53 | |
| 54 int src_id_; | 52 int src_id_; |
| 55 std::string port_; | 53 std::string port_; |
| 56 | 54 |
| 57 // SerialConnection will take ownership. | 55 // SerialConnection will take ownership. |
| 58 APIResourceEventNotifier* event_notifier_; | 56 APIResourceEventNotifier* event_notifier_; |
| 59 }; | 57 }; |
| 60 | 58 |
| 61 class SerialCloseFunction : public AsyncAPIFunction { | 59 class SerialCloseFunction : public AsyncAPIFunction { |
| 62 public: | 60 public: |
| 63 DECLARE_EXTENSION_FUNCTION_NAME("experimental.serial.close") | 61 DECLARE_EXTENSION_FUNCTION_NAME("experimental.serial.close") |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 protected: | 97 protected: |
| 100 virtual ~SerialWriteFunction(); | 98 virtual ~SerialWriteFunction(); |
| 101 | 99 |
| 102 // AsyncAPIFunction: | 100 // AsyncAPIFunction: |
| 103 virtual bool Prepare() OVERRIDE; | 101 virtual bool Prepare() OVERRIDE; |
| 104 virtual void Work() OVERRIDE; | 102 virtual void Work() OVERRIDE; |
| 105 virtual bool Respond() OVERRIDE; | 103 virtual bool Respond() OVERRIDE; |
| 106 | 104 |
| 107 private: | 105 private: |
| 108 int connection_id_; | 106 int connection_id_; |
| 109 scoped_refptr<net::IOBufferWithSize> io_buffer_; | 107 scoped_refptr<net::IOBuffer> io_buffer_; |
| 108 size_t io_buffer_size_; |
| 110 }; | 109 }; |
| 111 | 110 |
| 112 } // namespace extensions | 111 } // namespace extensions |
| 113 | 112 |
| 114 #endif // CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_API_H_ | 113 #endif // CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_API_H_ |
| OLD | NEW |