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_DISPLAY_PR
IVATE_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_DISPLAY_PR
IVATE_API_H_ |
| 7 |
| 8 #include "chrome/browser/extensions/api/api_function.h" |
| 9 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
| 10 #include "chrome/common/extensions/api/braille_display_private.h" |
| 11 |
| 12 namespace extensions { |
| 13 |
| 14 // Implementation of the chrome.brailleDisplayPrivate API. |
| 15 class BrailleDisplayPrivateAPI : public ProfileKeyedAPI { |
| 16 public: |
| 17 explicit BrailleDisplayPrivateAPI(Profile* profile); |
| 18 virtual ~BrailleDisplayPrivateAPI(); |
| 19 |
| 20 // ProfileKeyedService implementation. |
| 21 virtual void Shutdown() OVERRIDE; |
| 22 |
| 23 // ProfileKeyedAPI implementation. |
| 24 static ProfileKeyedAPIFactory<BrailleDisplayPrivateAPI>* GetFactoryInstance(); |
| 25 |
| 26 private: |
| 27 friend class ProfileKeyedAPIFactory<BrailleDisplayPrivateAPI>; |
| 28 |
| 29 Profile* profile_; |
| 30 |
| 31 // ProfileKeyedAPI implementation. |
| 32 static const char* service_name() { |
| 33 return "BrailleDisplayPrivateAPI"; |
| 34 } |
| 35 // Override the default so the service is not created in tests. |
| 36 static const bool kServiceIsNULLWhileTesting = true; |
| 37 }; |
| 38 |
| 39 namespace api { |
| 40 |
| 41 class BrailleDisplayPrivateGetDisplayStateFunction : public AsyncApiFunction { |
| 42 DECLARE_EXTENSION_FUNCTION("brailleDisplayPrivate.getDisplayState", |
| 43 BRAILLEDISPLAYPRIVATE_GETDISPLAYSTATE) |
| 44 protected: |
| 45 virtual ~BrailleDisplayPrivateGetDisplayStateFunction() {} |
| 46 virtual bool Prepare() OVERRIDE; |
| 47 virtual void Work() OVERRIDE; |
| 48 virtual bool Respond() OVERRIDE; |
| 49 }; |
| 50 |
| 51 class BrailleDisplayPrivateWriteDotsFunction : public AsyncApiFunction { |
| 52 DECLARE_EXTENSION_FUNCTION("brailleDisplayPrivate.writeDots", |
| 53 BRAILLEDISPLAYPRIVATE_WRITEDOTS); |
| 54 public: |
| 55 BrailleDisplayPrivateWriteDotsFunction(); |
| 56 |
| 57 protected: |
| 58 virtual ~BrailleDisplayPrivateWriteDotsFunction(); |
| 59 virtual bool Prepare() OVERRIDE; |
| 60 virtual void Work() OVERRIDE; |
| 61 virtual bool Respond() OVERRIDE; |
| 62 |
| 63 private: |
| 64 scoped_ptr<braille_display_private::WriteDots::Params> params_; |
| 65 }; |
| 66 |
| 67 } // namespace api |
| 68 } // namespace extensions |
| 69 |
| 70 #endif // CHROME_BROWSER_EXTENSIONS_API_BRAILLE_DISPLAY_PRIVATE_BRAILLE_DISPLAY
_PRIVATE_API_H_ |
OLD | NEW |