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

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 2378297f82b64641bc199c7f5b6dcf03ac21652d..d577c573c4769e57aeed14853b22557ff1edc157 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
@@ -11,6 +11,10 @@
class Profile;
+namespace input_method {
+class InputMethodEngine;
+} // namespace input_method
+
namespace extensions {
class InputImeEventRouterBase;
@@ -20,6 +24,32 @@ class InputImeEventRouter : public InputImeEventRouterBase {
explicit InputImeEventRouter(Profile* profile);
~InputImeEventRouter() override;
+ // Registers the extension as an IME extension, allowing it to be the active
+ // engine.
+ bool RegisterImeExtension(const std::string& extension_id);
+
+ // Unregisters the extension as an IME extension and deactivates the IME
+ // engine for it, if it was 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_;
+
DISALLOW_COPY_AND_ASSIGN(InputImeEventRouter);
};
@@ -34,6 +64,28 @@ class InputImeCreateWindowFunction : public UIThreadExtensionFunction {
ExtensionFunction::ResponseAction Run() override;
};
+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