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 ab66d5d995b2c6b1d8148dc5ee74014308795310..a85fdd40af6f62497f45d2fd200ae27e955b6f85 100644 |
--- a/chrome/browser/extensions/api/input_ime/input_ime_api.cc |
+++ b/chrome/browser/extensions/api/input_ime/input_ime_api.cc |
@@ -19,6 +19,7 @@ |
#include "extensions/browser/extension_function_registry.h" |
#include "extensions/browser/extension_registry.h" |
#include "extensions/browser/extension_system.h" |
+#include "extensions/browser/process_manager.h" |
#include "extensions/common/manifest_handlers/background_info.h" |
#include "ui/base/ime/chromeos/component_extension_ime_manager.h" |
#include "ui/base/ime/chromeos/extension_ime_util.h" |
@@ -81,6 +82,27 @@ static void DispatchEventToExtension(const std::string& extension_id, |
const std::string& event_name, |
scoped_ptr<base::ListValue> args) { |
Profile* profile = ProfileManager::GetActiveUserProfile(); |
+ if (event_name != input_ime::OnActivate::kEventName) { |
+ // For suspended IME extension (e.g. XKB extension), don't awake it by IME |
Seigo Nonaka
2015/01/29 09:11:29
I'm sorry but "suspended IME" and its example is n
Shu Chen
2015/01/30 14:38:29
"suspend" means the extension background is killed
Seigo Nonaka
2015/02/02 00:56:38
Oh, I didn't know extension background page can be
|
+ // events except onActivate. The IME extension should be awake by other |
+ // events (e.g. runtime.onMessage) from its other pages. |
+ // This is to save memory for steady state Chrome OS on which the users |
+ // don't want any IME features. |
+ extensions::ExtensionSystem* extension_system = |
+ extensions::ExtensionSystem::Get(profile); |
+ if (extension_system) { |
+ const extensions::Extension* extension = |
+ extension_system->extension_service()->GetExtensionById( |
+ extension_id, false /* include_disabled */); |
+ extensions::ProcessManager* process_manager = |
+ extensions::ProcessManager::Get(profile); |
+ if (extensions::BackgroundInfo::HasBackgroundPage(extension) && |
+ !process_manager->GetBackgroundHostForExtension(extension_id)) { |
+ return; |
+ } |
+ } |
+ } |
+ |
scoped_ptr<extensions::Event> event(new extensions::Event( |
event_name, args.Pass())); |
event->restrict_to_browser_context = profile; |