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

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

Issue 884713005: For suspended IME extension (e.g. XKB extension), don't awake it by IME events except onActivate. T… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698