| 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_BRAILLE_CONTROLLER
_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROLLER
_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROLLER
_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROLLER
_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
| 12 #include "base/macros.h" | 12 #include "base/macros.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/common/extensions/api/braille_display_private.h" | 14 #include "chrome/common/extensions/api/braille_display_private.h" |
| 15 | 15 |
| 16 namespace extensions { | 16 namespace extensions { |
| 17 namespace api { | 17 namespace api { |
| 18 namespace braille_display_private { | 18 namespace braille_display_private { |
| 19 class BrailleObserver; | 19 class BrailleObserver; |
| 20 | 20 |
| 21 // Singleton class that controls the braille display. | 21 // Singleton class that controls the braille display. |
| 22 class BrailleController { | 22 class BrailleController { |
| 23 public: | 23 public: |
| 24 static BrailleController* GetInstance(); | 24 static BrailleController* GetInstance(); |
| 25 | 25 |
| 26 virtual std::unique_ptr<DisplayState> GetDisplayState() = 0; | 26 virtual std::unique_ptr<DisplayState> GetDisplayState() = 0; |
| 27 virtual void WriteDots(const std::vector<char>& cells) = 0; | 27 virtual void WriteDots(const std::vector<char>& cells, |
| 28 unsigned int cols, |
| 29 unsigned int rows) = 0; |
| 28 virtual void AddObserver(BrailleObserver* observer) = 0; | 30 virtual void AddObserver(BrailleObserver* observer) = 0; |
| 29 virtual void RemoveObserver(BrailleObserver* observer) = 0; | 31 virtual void RemoveObserver(BrailleObserver* observer) = 0; |
| 30 | 32 |
| 31 protected: | 33 protected: |
| 32 BrailleController(); | 34 BrailleController(); |
| 33 virtual ~BrailleController(); | 35 virtual ~BrailleController(); |
| 34 | 36 |
| 35 private: | 37 private: |
| 36 DISALLOW_COPY_AND_ASSIGN(BrailleController); | 38 DISALLOW_COPY_AND_ASSIGN(BrailleController); |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 // Observer for events from the BrailleController | 41 // Observer for events from the BrailleController |
| 40 class BrailleObserver { | 42 class BrailleObserver { |
| 41 public: | 43 public: |
| 42 virtual void OnBrailleDisplayStateChanged( | 44 virtual void OnBrailleDisplayStateChanged( |
| 43 const DisplayState& display_state) {} | 45 const DisplayState& display_state) {} |
| 44 virtual void OnBrailleKeyEvent(const KeyEvent& event) {} | 46 virtual void OnBrailleKeyEvent(const KeyEvent& event) {} |
| 45 }; | 47 }; |
| 46 | 48 |
| 47 } // namespace braille_display_private | 49 } // namespace braille_display_private |
| 48 } // namespace api | 50 } // namespace api |
| 49 } // namespace extensions | 51 } // namespace extensions |
| 50 | 52 |
| 51 #endif // CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROL
LER_H_ | 53 #endif // CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROL
LER_H_ |
| OLD | NEW |