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

Unified Diff: chrome/browser/extensions/api/input_ime/input_ime_api.cc

Issue 11618005: Pull InputIme stuff out of ExtensionService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit fixed Created 8 years 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.cc
diff --git a/chrome/browser/extensions/api/input_ime/input_ime_api.cc b/chrome/browser/extensions/api/input_ime/input_ime_api.cc
index 4b7644162fe3ab66b04044ac9e751992be522fcf..0640c39f34c3fff7fe3ae5a9de0e16bfbc2f805b 100644
--- a/chrome/browser/extensions/api/input_ime/input_ime_api.cc
+++ b/chrome/browser/extensions/api/input_ime/input_ime_api.cc
@@ -315,8 +315,6 @@ InputImeEventRouter::GetInstance() {
return Singleton<InputImeEventRouter>::get();
}
-void InputImeEventRouter::Init() {}
-
#if defined(OS_CHROMEOS)
bool InputImeEventRouter::RegisterIme(
Profile* profile,
@@ -837,4 +835,43 @@ bool KeyEventHandled::RunImpl() {
}
#endif
+InputImeAPI::InputImeAPI(Profile* profile)
+ : profile_(profile) {
+ registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
+ content::Source<Profile>(profile));
+ registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
+ content::Source<Profile>(profile));
+}
+
+InputImeAPI::~InputImeAPI() {
+}
+
+void InputImeAPI::Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ if (type == chrome::NOTIFICATION_EXTENSION_LOADED) {
+ const Extension* extension =
+ content::Details<const Extension>(details).ptr();
+ for (std::vector<Extension::InputComponentInfo>::const_iterator component =
+ extension->input_components().begin();
+ component != extension->input_components().end();
+ ++component) {
+ if (component->type == Extension::INPUT_COMPONENT_TYPE_IME) {
+ input_ime_event_router()->RegisterIme(
+ profile_, extension->id(), *component);
+ }
+ }
+ } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) {
+ const Extension* extension =
+ content::Details<const UnloadedExtensionInfo>(details)->extension;
+ if (extension->input_components().size() > 0) {
+ input_ime_event_router()->UnregisterAllImes(profile_, extension->id());
+ }
+ }
+}
+
+InputImeEventRouter* InputImeAPI::input_ime_event_router() {
+ return InputImeEventRouter::GetInstance();
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698