| 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_DISPLAY_PR
IVATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_DISPLAY_PR
IVATE_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_DISPLAY_PR
IVATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_DISPLAY_PR
IVATE_API_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/extensions/api/api_function.h" | 8 #include "chrome/browser/extensions/api/api_function.h" |
| 9 #include "chrome/browser/extensions/api/braille_display_private/braille_controll
er.h" |
| 9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" | 10 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
| 10 #include "chrome/common/extensions/api/braille_display_private.h" | 11 #include "chrome/common/extensions/api/braille_display_private.h" |
| 11 | 12 |
| 12 namespace extensions { | 13 namespace extensions { |
| 13 | 14 |
| 14 // Implementation of the chrome.brailleDisplayPrivate API. | 15 // Implementation of the chrome.brailleDisplayPrivate API. |
| 15 class BrailleDisplayPrivateAPI : public ProfileKeyedAPI { | 16 class BrailleDisplayPrivateAPI |
| 17 : public ProfileKeyedAPI, |
| 18 api::braille_display_private::BrailleController::Observer { |
| 16 public: | 19 public: |
| 17 explicit BrailleDisplayPrivateAPI(Profile* profile); | 20 explicit BrailleDisplayPrivateAPI(Profile* profile); |
| 18 virtual ~BrailleDisplayPrivateAPI(); | 21 virtual ~BrailleDisplayPrivateAPI(); |
| 19 | 22 |
| 20 // ProfileKeyedService implementation. | 23 // ProfileKeyedService implementation. |
| 21 virtual void Shutdown() OVERRIDE; | 24 virtual void Shutdown() OVERRIDE; |
| 22 | 25 |
| 23 // ProfileKeyedAPI implementation. | 26 // ProfileKeyedAPI implementation. |
| 24 static ProfileKeyedAPIFactory<BrailleDisplayPrivateAPI>* GetFactoryInstance(); | 27 static ProfileKeyedAPIFactory<BrailleDisplayPrivateAPI>* GetFactoryInstance(); |
| 25 | 28 |
| 29 // BrailleController::Observer implementation. |
| 30 virtual void OnKeyEvent( |
| 31 const api::braille_display_private::KeyEvent& keyEvent) OVERRIDE; |
| 32 |
| 26 private: | 33 private: |
| 27 friend class ProfileKeyedAPIFactory<BrailleDisplayPrivateAPI>; | 34 friend class ProfileKeyedAPIFactory<BrailleDisplayPrivateAPI>; |
| 28 | 35 |
| 29 Profile* profile_; | 36 Profile* profile_; |
| 30 | 37 |
| 31 // ProfileKeyedAPI implementation. | 38 // ProfileKeyedAPI implementation. |
| 32 static const char* service_name() { | 39 static const char* service_name() { |
| 33 return "BrailleDisplayPrivateAPI"; | 40 return "BrailleDisplayPrivateAPI"; |
| 34 } | 41 } |
| 35 // Override the default so the service is not created in tests. | 42 // Override the default so the service is not created in tests. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 61 virtual bool Respond() OVERRIDE; | 68 virtual bool Respond() OVERRIDE; |
| 62 | 69 |
| 63 private: | 70 private: |
| 64 scoped_ptr<braille_display_private::WriteDots::Params> params_; | 71 scoped_ptr<braille_display_private::WriteDots::Params> params_; |
| 65 }; | 72 }; |
| 66 | 73 |
| 67 } // namespace api | 74 } // namespace api |
| 68 } // namespace extensions | 75 } // namespace extensions |
| 69 | 76 |
| 70 #endif // CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_DISPLAY
_PRIVATE_API_H_ | 77 #endif // CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_DISPLAY
_PRIVATE_API_H_ |
| OLD | NEW |