| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chrome/browser/extensions/api/braille_display_private/brlapi_connectio
n.h" | 5 #include "chrome/browser/extensions/api/braille_display_private/brlapi_connectio
n.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 MessageLoopForIO::Watcher { | 31 MessageLoopForIO::Watcher { |
| 32 public: | 32 public: |
| 33 explicit BrlapiConnectionImpl(LibBrlapiLoader* loader) : | 33 explicit BrlapiConnectionImpl(LibBrlapiLoader* loader) : |
| 34 libbrlapi_loader_(loader) {} | 34 libbrlapi_loader_(loader) {} |
| 35 | 35 |
| 36 virtual ~BrlapiConnectionImpl() { | 36 virtual ~BrlapiConnectionImpl() { |
| 37 Disconnect(); | 37 Disconnect(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 virtual ConnectResult Connect(const OnDataReadyCallback& on_data_ready) | 40 virtual ConnectResult Connect(const OnDataReadyCallback& on_data_ready) |
| 41 OVERRIDE; | 41 override; |
| 42 virtual void Disconnect() OVERRIDE; | 42 virtual void Disconnect() override; |
| 43 virtual bool Connected() OVERRIDE { return handle_; } | 43 virtual bool Connected() override { return handle_; } |
| 44 virtual brlapi_error_t* BrlapiError() OVERRIDE; | 44 virtual brlapi_error_t* BrlapiError() override; |
| 45 virtual std::string BrlapiStrError() OVERRIDE; | 45 virtual std::string BrlapiStrError() override; |
| 46 virtual bool GetDisplaySize(size_t* size) OVERRIDE; | 46 virtual bool GetDisplaySize(size_t* size) override; |
| 47 virtual bool WriteDots(const unsigned char* cells) OVERRIDE; | 47 virtual bool WriteDots(const unsigned char* cells) override; |
| 48 virtual int ReadKey(brlapi_keyCode_t* keyCode) OVERRIDE; | 48 virtual int ReadKey(brlapi_keyCode_t* keyCode) override; |
| 49 | 49 |
| 50 // MessageLoopForIO::Watcher | 50 // MessageLoopForIO::Watcher |
| 51 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE { | 51 virtual void OnFileCanReadWithoutBlocking(int fd) override { |
| 52 on_data_ready_.Run(); | 52 on_data_ready_.Run(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE {} | 55 virtual void OnFileCanWriteWithoutBlocking(int fd) override {} |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 bool CheckConnected(); | 58 bool CheckConnected(); |
| 59 ConnectResult ConnectResultForError(); | 59 ConnectResult ConnectResultForError(); |
| 60 | 60 |
| 61 LibBrlapiLoader* libbrlapi_loader_; | 61 LibBrlapiLoader* libbrlapi_loader_; |
| 62 scoped_ptr<brlapi_handle_t, base::FreeDeleter> handle_; | 62 scoped_ptr<brlapi_handle_t, base::FreeDeleter> handle_; |
| 63 MessageLoopForIO::FileDescriptorWatcher fd_controller_; | 63 MessageLoopForIO::FileDescriptorWatcher fd_controller_; |
| 64 OnDataReadyCallback on_data_ready_; | 64 OnDataReadyCallback on_data_ready_; |
| 65 | 65 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 if (error->brlerrno == BRLAPI_ERROR_LIBCERR | 212 if (error->brlerrno == BRLAPI_ERROR_LIBCERR |
| 213 && error->libcerrno == ENOENT) { | 213 && error->libcerrno == ENOENT) { |
| 214 return CONNECT_ERROR_NO_RETRY; | 214 return CONNECT_ERROR_NO_RETRY; |
| 215 } | 215 } |
| 216 return CONNECT_ERROR_RETRY; | 216 return CONNECT_ERROR_RETRY; |
| 217 } | 217 } |
| 218 | 218 |
| 219 } // namespace braille_display_private | 219 } // namespace braille_display_private |
| 220 } // namespace api | 220 } // namespace api |
| 221 } // namespace extensions | 221 } // namespace extensions |
| OLD | NEW |