Index: chrome/browser/chromeos/extensions/input_method_api.cc |
diff --git a/chrome/browser/chromeos/extensions/input_method_api.cc b/chrome/browser/chromeos/extensions/input_method_api.cc |
index b9dce24e01dbd52c4efd81b1ff1a4bc47331f5bd..1980ed692ac029aa36a7de41ff74bd2e98fec8da 100644 |
--- a/chrome/browser/chromeos/extensions/input_method_api.cc |
+++ b/chrome/browser/chromeos/extensions/input_method_api.cc |
@@ -11,6 +11,7 @@ |
#include "base/lazy_instance.h" |
#include "base/values.h" |
#include "chrome/browser/chromeos/extensions/dictionary_event_router.h" |
+#include "chrome/browser/chromeos/extensions/ime_menu_event_router.h" |
#include "chrome/browser/chromeos/extensions/input_method_event_router.h" |
#include "chrome/browser/chromeos/input_method/input_method_util.h" |
#include "chrome/browser/extensions/api/input_ime/input_ime_api.h" |
@@ -183,11 +184,21 @@ const char InputMethodAPI::kOnDictionaryLoaded[] = |
const char InputMethodAPI::kOnInputMethodChanged[] = |
"inputMethodPrivate.onChanged"; |
+// static |
+const char InputMethodAPI::kOnImeMenuActivated[] = |
+ "inputMethodPrivate.onImeMenuActivated"; |
+ |
+// static |
+const char InputMethodAPI::kOnImeMenuDeactivated[] = |
+ "inputMethodPrivate.onImeMenuDeactivated"; |
+ |
InputMethodAPI::InputMethodAPI(content::BrowserContext* context) |
: context_(context) { |
EventRouter::Get(context_)->RegisterObserver(this, kOnInputMethodChanged); |
EventRouter::Get(context_)->RegisterObserver(this, kOnDictionaryChanged); |
EventRouter::Get(context_)->RegisterObserver(this, kOnDictionaryLoaded); |
+ EventRouter::Get(context_)->RegisterObserver(this, kOnImeMenuActivated); |
+ EventRouter::Get(context_)->RegisterObserver(this, kOnImeMenuDeactivated); |
ExtensionFunctionRegistry* registry = |
ExtensionFunctionRegistry::GetInstance(); |
registry->RegisterFunction<GetInputMethodConfigFunction>(); |
@@ -231,6 +242,12 @@ void InputMethodAPI::OnListenerAdded( |
if (details.event_name == kOnDictionaryLoaded) { |
dictionary_event_router_->DispatchLoadedEventIfLoaded(); |
} |
+ } else if (details.event_name == kOnImeMenuActivated || |
+ details.event_name == kOnImeMenuDeactivated) { |
+ if (!ime_menu_event_router_.get()) { |
+ ime_menu_event_router_.reset( |
+ new chromeos::ExtensionImeMenuEventRouter(context_)); |
+ } |
} |
} |