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_PRIVATE_BRAILLE_PRIVATE_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_PRIVATE_BRAILLE_PRIVATE_API_H_ |
| 7 |
| 8 #include "chrome/browser/extensions/api/api_function.h" |
| 9 #include "chrome/browser/extensions/api/braille_private/braille_controller.h" |
| 10 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
| 11 #include "chrome/common/extensions/api/braille_private.h" |
| 12 |
| 13 namespace extensions { |
| 14 |
| 15 class BraillePrivateAPI : public ProfileKeyedAPI, |
| 16 api::braille_private::BrailleController::Observer { |
| 17 public: |
| 18 explicit BraillePrivateAPI(Profile* profile); |
| 19 virtual ~BraillePrivateAPI(); |
| 20 |
| 21 // ProfileKeyedService implementation. |
| 22 virtual void Shutdown() OVERRIDE; |
| 23 |
| 24 // ProfileKeyedAPI implementation. |
| 25 static ProfileKeyedAPIFactory<BraillePrivateAPI>* GetFactoryInstance(); |
| 26 |
| 27 // BrailleController::Observer implementation. |
| 28 virtual void OnKeyEvent(scoped_ptr<base::DictionaryValue> event); |
| 29 |
| 30 |
| 31 private: |
| 32 friend class ProfileKeyedAPIFactory<BraillePrivateAPI>; |
| 33 |
| 34 Profile* profile_; |
| 35 |
| 36 // ProfileKeyedAPI implementation. |
| 37 static const char* service_name() { |
| 38 return "BraillePrivateAPI"; |
| 39 } |
| 40 static const bool kServiceIsNULLWhileTesting = true; |
| 41 |
| 42 }; |
| 43 |
| 44 namespace api { |
| 45 class BraillePrivateGetDisplayStateFunction : public AsyncApiFunction { |
| 46 DECLARE_EXTENSION_FUNCTION("braillePrivate.getDisplayState", |
| 47 BRAILLEPRIVATE_WRITETEXT) |
| 48 protected: |
| 49 virtual bool Prepare() OVERRIDE; |
| 50 virtual void Work() OVERRIDE; |
| 51 virtual bool Respond() OVERRIDE; |
| 52 }; |
| 53 |
| 54 class BraillePrivateWriteTextFunction : public AsyncApiFunction { |
| 55 DECLARE_EXTENSION_FUNCTION("braillePrivate.writeText", |
| 56 BRAILLEPRIVATE_WRITETEXT) |
| 57 protected: |
| 58 virtual bool Prepare() OVERRIDE; |
| 59 virtual void Work() OVERRIDE; |
| 60 virtual bool Respond() OVERRIDE; |
| 61 private: |
| 62 scoped_ptr<braille_private::WriteText::Params> params_; |
| 63 }; |
| 64 |
| 65 class BraillePrivateWriteDotsFunction : public AsyncApiFunction { |
| 66 DECLARE_EXTENSION_FUNCTION("braillePrivate.writeDots", |
| 67 BRAILLEPRIVATE_WRITEDOTS) |
| 68 protected: |
| 69 virtual bool Prepare() OVERRIDE; |
| 70 virtual void Work() OVERRIDE; |
| 71 virtual bool Respond() OVERRIDE; |
| 72 }; |
| 73 } // namespace api |
| 74 } // namespace extensions |
| 75 #endif // CHROME_BROWSER_EXTENSIONS_API_BRAILLE_PRIVATE_BRAILLE_PRIVATE_API_H_ |
OLD | NEW |