| 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRLAPI_CONNECTION_
H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRLAPI_CONNECTION_
H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRLAPI_CONNECTION_
H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRLAPI_CONNECTION_
H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> |
| 11 |
| 10 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
| 11 #include "base/macros.h" | 13 #include "base/macros.h" |
| 12 #include "base/memory/scoped_ptr.h" | |
| 13 #include "library_loaders/libbrlapi.h" | 14 #include "library_loaders/libbrlapi.h" |
| 14 | 15 |
| 15 namespace extensions { | 16 namespace extensions { |
| 16 namespace api { | 17 namespace api { |
| 17 namespace braille_display_private { | 18 namespace braille_display_private { |
| 18 | 19 |
| 19 // A connection to the brlapi server. See brlapi.h for more information | 20 // A connection to the brlapi server. See brlapi.h for more information |
| 20 // about the semantics of the methods in this class. | 21 // about the semantics of the methods in this class. |
| 21 class BrlapiConnection { | 22 class BrlapiConnection { |
| 22 public: | 23 public: |
| 23 typedef base::Closure OnDataReadyCallback; | 24 typedef base::Closure OnDataReadyCallback; |
| 24 | 25 |
| 25 enum ConnectResult { | 26 enum ConnectResult { |
| 26 CONNECT_ERROR_RETRY, | 27 CONNECT_ERROR_RETRY, |
| 27 CONNECT_ERROR_NO_RETRY, | 28 CONNECT_ERROR_NO_RETRY, |
| 28 CONNECT_SUCCESS, | 29 CONNECT_SUCCESS, |
| 29 }; | 30 }; |
| 30 | 31 |
| 31 static scoped_ptr<BrlapiConnection> Create(LibBrlapiLoader* loader); | 32 static std::unique_ptr<BrlapiConnection> Create(LibBrlapiLoader* loader); |
| 32 | 33 |
| 33 virtual ~BrlapiConnection(); | 34 virtual ~BrlapiConnection(); |
| 34 | 35 |
| 35 virtual ConnectResult Connect(const OnDataReadyCallback& onDataReady) = 0; | 36 virtual ConnectResult Connect(const OnDataReadyCallback& onDataReady) = 0; |
| 36 | 37 |
| 37 virtual void Disconnect() = 0; | 38 virtual void Disconnect() = 0; |
| 38 | 39 |
| 39 virtual bool Connected() = 0; | 40 virtual bool Connected() = 0; |
| 40 | 41 |
| 41 // Gets the last brlapi error on this thread. | 42 // Gets the last brlapi error on this thread. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 67 protected: | 68 protected: |
| 68 BrlapiConnection(); | 69 BrlapiConnection(); |
| 69 DISALLOW_COPY_AND_ASSIGN(BrlapiConnection); | 70 DISALLOW_COPY_AND_ASSIGN(BrlapiConnection); |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 } // namespace braille_display_private | 73 } // namespace braille_display_private |
| 73 } // namespace api | 74 } // namespace api |
| 74 } // namespace extensions | 75 } // namespace extensions |
| 75 | 76 |
| 76 #endif // CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRLAPI_CONNECTI
ON_H_ | 77 #endif // CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRLAPI_CONNECTI
ON_H_ |
| OLD | NEW |