Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3167)

Unified Diff: chrome/browser/extensions/api/braille_private/braille_private_api.h

Issue 13355002: Implement chrome.brailleDisplayPrivate API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/braille_private/braille_private_api.h
diff --git a/chrome/browser/extensions/api/braille_private/braille_private_api.h b/chrome/browser/extensions/api/braille_private/braille_private_api.h
new file mode 100644
index 0000000000000000000000000000000000000000..dcb3ab62a3b81e2a50732a24a19cc9a1fb6706c4
--- /dev/null
+++ b/chrome/browser/extensions/api/braille_private/braille_private_api.h
@@ -0,0 +1,75 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_API_BRAILLE_PRIVATE_BRAILLE_PRIVATE_API_H_
+#define CHROME_BROWSER_EXTENSIONS_API_BRAILLE_PRIVATE_BRAILLE_PRIVATE_API_H_
+
+#include "chrome/browser/extensions/api/api_function.h"
+#include "chrome/browser/extensions/api/braille_private/braille_controller.h"
+#include "chrome/browser/extensions/api/profile_keyed_api_factory.h"
+#include "chrome/common/extensions/api/braille_private.h"
+
+namespace extensions {
+
+class BraillePrivateAPI : public ProfileKeyedAPI,
+ api::braille_private::BrailleController::Observer {
+ public:
+ explicit BraillePrivateAPI(Profile* profile);
+ virtual ~BraillePrivateAPI();
+
+ // ProfileKeyedService implementation.
+ virtual void Shutdown() OVERRIDE;
+
+ // ProfileKeyedAPI implementation.
+ static ProfileKeyedAPIFactory<BraillePrivateAPI>* GetFactoryInstance();
+
+ // BrailleController::Observer implementation.
+ virtual void OnKeyEvent(scoped_ptr<base::DictionaryValue> event);
+
+
+ private:
+ friend class ProfileKeyedAPIFactory<BraillePrivateAPI>;
+
+ Profile* profile_;
+
+ // ProfileKeyedAPI implementation.
+ static const char* service_name() {
+ return "BraillePrivateAPI";
+ }
+ static const bool kServiceIsNULLWhileTesting = true;
+
+};
+
+namespace api {
+class BraillePrivateGetDisplayStateFunction : public AsyncApiFunction {
+ DECLARE_EXTENSION_FUNCTION("braillePrivate.getDisplayState",
+ BRAILLEPRIVATE_WRITETEXT)
+ protected:
+ virtual bool Prepare() OVERRIDE;
+ virtual void Work() OVERRIDE;
+ virtual bool Respond() OVERRIDE;
+};
+
+class BraillePrivateWriteTextFunction : public AsyncApiFunction {
+ DECLARE_EXTENSION_FUNCTION("braillePrivate.writeText",
+ BRAILLEPRIVATE_WRITETEXT)
+ protected:
+ virtual bool Prepare() OVERRIDE;
+ virtual void Work() OVERRIDE;
+ virtual bool Respond() OVERRIDE;
+ private:
+ scoped_ptr<braille_private::WriteText::Params> params_;
+};
+
+class BraillePrivateWriteDotsFunction : public AsyncApiFunction {
+ DECLARE_EXTENSION_FUNCTION("braillePrivate.writeDots",
+ BRAILLEPRIVATE_WRITEDOTS)
+ protected:
+ virtual bool Prepare() OVERRIDE;
+ virtual void Work() OVERRIDE;
+ virtual bool Respond() OVERRIDE;
+};
+} // namespace api
+} // namespace extensions
+#endif // CHROME_BROWSER_EXTENSIONS_API_BRAILLE_PRIVATE_BRAILLE_PRIVATE_API_H_

Powered by Google App Engine
This is Rietveld 408576698