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

Unified Diff: chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h

Issue 1528483002: Add chrome.input.ime.activate and chrome.input.ime.deactivate API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/input_ime/input_ime_api_nonchromeos.h
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h b/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h
index c3567aed81df176121220e570e2b94b6e3756fa1..6681e80057d77c3979c80a08d73e7535e9a7a004 100644
--- a/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h
+++ b/chrome/browser/extensions/api/input_ime/input_ime_api_nonchromeos.h
@@ -7,9 +7,14 @@
#include "chrome/browser/extensions/api/input_ime/input_ime_event_router_base.h"
#include "chrome/browser/profiles/profile.h"
+#include "extensions/browser/extension_function.h"
class Profile;
+namespace input_method {
+class InputMethodEngine;
+} // namespace input_method
+
namespace extensions {
class InputImeEventRouterBase;
@@ -18,9 +23,58 @@ class InputImeEventRouter : public InputImeEventRouterBase {
explicit InputImeEventRouter(Profile* profile);
~InputImeEventRouter() override;
+ // Registers the extension by saving the |extension_id| in the vector
Devlin 2016/01/15 22:06:02 When making class comments, try to describe the in
Azure Wei 2016/01/19 03:46:54 Done. Thank you for your suggestion.
+ // |extension_ids_|.
+ bool RegisterImeExtension(const std::string& extension_id);
+
+ // Unregisters the extension by deleting the |extesion_id| from the vector
+ // |extension_ids_|, and deletes the input method engine if the extenstion
+ // is active.
+ void UnregisterImeExtension(const std::string& extension_id);
+
+ // Gets the input method engine if the extension is active.
+ input_method::InputMethodEngine* GetActiveEngine(
+ const std::string& extension_id);
+
+ // Actives the extension with new input method engine, and deletes the
+ // previous engine if another extension was active.
+ void SetActiveEngine(const std::string& extension_id);
+
+ private:
+ // Deletes the current input method engine.
+ void DeleteInputMethodEngine();
+
+ // The active input method engine.
+ input_method::InputMethodEngine* active_engine_;
+
+ // The id of the all registered extensions.
+ std::vector<std::string> extension_ids_;
Devlin 2016/01/15 22:06:02 Out of curiosity, why do we even need this list (o
Azure Wei 2016/01/19 03:46:54 Yeah, extension_ids_ doesn't really work now. It w
+
DISALLOW_COPY_AND_ASSIGN(InputImeEventRouter);
};
+class InputImeActivateFunction : public UIThreadExtensionFunction {
+ public:
+ DECLARE_EXTENSION_FUNCTION("input.ime.activate", INPUT_IME_ACTIVATE)
+
+ protected:
+ ~InputImeActivateFunction() override {}
+
+ // UIThreadExtensionFunction:
+ ResponseAction Run() override;
+};
+
+class InputImeDeactivateFunction : public UIThreadExtensionFunction {
+ public:
+ DECLARE_EXTENSION_FUNCTION("input.ime.deactivate", INPUT_IME_DEACTIVATE)
+
+ protected:
+ ~InputImeDeactivateFunction() override {}
+
+ // UIThreadExtensionFunction:
+ ResponseAction Run() override;
+};
+
} // namespace extensions
#endif // CHROME_BROWSER_EXTENSIONS_API_INPUT_IME_INPUT_IME_API_NONCHROMEOS_H_

Powered by Google App Engine
This is Rietveld 408576698