Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROLLER _H_ | |
| 6 | |
| 7 #define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROLLER _H_ | |
| 8 | |
| 9 #include <string> | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/callback_forward.h" | |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "base/values.h" | |
| 15 #include "chrome/common/extensions/api/braille_display_private.h" | |
| 16 | |
| 17 namespace extensions { | |
| 18 namespace api { | |
| 19 namespace braille_display_private { | |
| 20 class BrailleObserver; | |
| 21 | |
| 22 #ifdef USE_BRLAPI | |
| 23 class BrlapiConnection; | |
|
dmazzoni
2013/09/10 19:50:08
Why does this need to be in an ifdef?
| |
| 24 #endif // USE_BRLAPI | |
| 25 | |
| 26 // Singleton class that controls the braille display. | |
| 27 class BrailleController { | |
| 28 public: | |
| 29 static BrailleController* GetInstance(); | |
| 30 | |
| 31 #ifdef USE_BRLAPI | |
| 32 typedef base::Callback<scoped_ptr<BrlapiConnection>()> | |
|
dmazzoni
2013/09/10 19:50:08
Why does this need to be in an ifdef?
| |
| 33 CreateBrlapiConnectionFunction; | |
| 34 // For dependency injection in tests. Sets the function used to create | |
| 35 // brlapi connections. | |
| 36 virtual void SetCreateBrlapiConnectionForTesting( | |
|
dmazzoni
2013/09/10 19:50:08
Can you just put this into a subclass of BrailleCo
| |
| 37 const CreateBrlapiConnectionFunction& callback) = 0; | |
| 38 #endif // USE_BRLAPI | |
| 39 | |
| 40 virtual scoped_ptr<base::DictionaryValue> GetDisplayState() = 0; | |
| 41 virtual void WriteDots(const std::string& cells) = 0; | |
| 42 virtual void AddObserver(BrailleObserver* observer) = 0; | |
| 43 virtual void RemoveObserver(BrailleObserver* observer) = 0; | |
| 44 | |
| 45 protected: | |
| 46 BrailleController(); | |
| 47 virtual ~BrailleController(); | |
| 48 | |
| 49 private: | |
| 50 DISALLOW_COPY_AND_ASSIGN(BrailleController); | |
| 51 }; | |
| 52 | |
| 53 // Observer for events from the BrailleController | |
| 54 class BrailleObserver { | |
| 55 public: | |
| 56 virtual void OnKeyEvent( | |
| 57 const extensions::api::braille_display_private::KeyEvent &event) {} | |
| 58 }; | |
| 59 | |
| 60 } // namespace braille_display_private | |
| 61 } // namespace api | |
| 62 } // namespace extensions | |
| 63 | |
| 64 #endif // CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_CONTROL LER_H_ | |
| OLD | NEW |