#ifndef CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_IO_HANDLER_WIN_H_
#define CHROME_BROWSER_EXTENSIONS_API_SERIAL_SERIAL_IO_HANDLER_WIN_H_
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "chrome/browser/extensions/api/serial/serial_io_handler.h"
namespace extensions {
class SerialIoHandlerWin : public SerialIoHandler,
public base::MessageLoopForIO::IOHandler {
protected:
virtual void InitializeImpl() OVERRIDE;
virtual void ReadImpl() OVERRIDE;
virtual void WriteImpl() OVERRIDE;
virtual void CancelReadImpl() OVERRIDE;
virtual void CancelWriteImpl() OVERRIDE;
private:
friend class SerialIoHandler;
SerialIoHandlerWin();
virtual ~SerialIoHandlerWin();
virtual void OnIOCompleted(base::MessageLoopForIO::IOContext* context,
DWORD bytes_transfered,
DWORD error) OVERRIDE;
scoped_ptr<base::MessageLoopForIO::IOContext> comm_context_;
scoped_ptr<base::MessageLoopForIO::IOContext> read_context_;
scoped_ptr<base::MessageLoopForIO::IOContext> write_context_;
DWORD event_mask_;
bool is_comm_pending_;
DISALLOW_COPY_AND_ASSIGN(SerialIoHandlerWin);
};
}
#endif