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

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

Issue 11440004: Remove deprecated extension EventRouter APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: compile 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 63a0dfe23d4de84ca7f84eb3de04fdaa14f5d80e..4b7644162fe3ab66b04044ac9e751992be522fcf 100644
--- a/chrome/browser/extensions/api/input_ime/input_ime_api.cc
+++ b/chrome/browser/extensions/api/input_ime/input_ime_api.cc
@@ -125,6 +125,17 @@ bool ReadMenuItems(
return true;
}
+static void DispatchEventToExtension(Profile* profile,
+ const std::string& extension_id,
+ const std::string& event_name,
+ scoped_ptr<ListValue> args) {
+ scoped_ptr<extensions::Event> event(new extensions::Event(
+ event_name, args.Pass()));
+ event->restrict_to_profile = profile;
+ extensions::ExtensionSystem::Get(profile)->event_router()->
+ DispatchEventToExtension(extension_id, event.Pass());
+}
+
} // namespace
namespace events {
@@ -159,9 +170,8 @@ class ImeObserver : public chromeos::InputMethodEngine::Observer {
scoped_ptr<base::ListValue> args(new ListValue());
args->Append(Value::CreateStringValue(engine_id));
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToExtension(extension_id_, events::kOnActivate,
- args.Pass(), profile_, GURL());
+ DispatchEventToExtension(profile_, extension_id_,
+ events::kOnActivate, args.Pass());
}
virtual void OnDeactivated(const std::string& engine_id) OVERRIDE {
@@ -171,9 +181,8 @@ class ImeObserver : public chromeos::InputMethodEngine::Observer {
scoped_ptr<base::ListValue> args(new ListValue());
args->Append(Value::CreateStringValue(engine_id));
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToExtension(extension_id_, events::kOnDeactivated,
- args.Pass(), profile_, GURL());
+ DispatchEventToExtension(profile_, extension_id_,
+ events::kOnDeactivated, args.Pass());
}
virtual void OnFocus(
@@ -188,9 +197,8 @@ class ImeObserver : public chromeos::InputMethodEngine::Observer {
scoped_ptr<base::ListValue> args(new ListValue());
args->Append(dict);
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToExtension(extension_id_, events::kOnFocus,
- args.Pass(), profile_, GURL());
+ DispatchEventToExtension(profile_, extension_id_,
+ events::kOnFocus, args.Pass());
}
virtual void OnBlur(int context_id) OVERRIDE {
@@ -200,9 +208,8 @@ class ImeObserver : public chromeos::InputMethodEngine::Observer {
scoped_ptr<base::ListValue> args(new ListValue());
args->Append(Value::CreateIntegerValue(context_id));
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToExtension(extension_id_, events::kOnBlur,
- args.Pass(), profile_, GURL());
+ DispatchEventToExtension(profile_, extension_id_,
+ events::kOnBlur, args.Pass());
}
virtual void OnInputContextUpdate(
@@ -217,9 +224,8 @@ class ImeObserver : public chromeos::InputMethodEngine::Observer {
scoped_ptr<base::ListValue> args(new ListValue());
args->Append(dict);
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToExtension(extension_id_, events::kOnInputContextUpdate,
- args.Pass(), profile_, GURL());
+ DispatchEventToExtension(profile_, extension_id_,
+ events::kOnInputContextUpdate, args.Pass());
}
virtual void OnKeyEvent(
@@ -245,9 +251,8 @@ class ImeObserver : public chromeos::InputMethodEngine::Observer {
args->Append(Value::CreateStringValue(engine_id));
args->Append(dict);
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToExtension(extension_id_, events::kOnKeyEvent,
- args.Pass(), profile_, GURL());
+ DispatchEventToExtension(profile_, extension_id_,
+ events::kOnKeyEvent, args.Pass());
}
virtual void OnCandidateClicked(
@@ -276,9 +281,8 @@ class ImeObserver : public chromeos::InputMethodEngine::Observer {
break;
}
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToExtension(extension_id_, events::kOnCandidateClicked,
- args.Pass(), profile_, GURL());
+ DispatchEventToExtension(profile_, extension_id_,
+ events::kOnCandidateClicked, args.Pass());
}
virtual void OnMenuItemActivated(const std::string& engine_id,
@@ -290,9 +294,8 @@ class ImeObserver : public chromeos::InputMethodEngine::Observer {
args->Append(Value::CreateStringValue(engine_id));
args->Append(Value::CreateStringValue(menu_id));
- extensions::ExtensionSystem::Get(profile_)->event_router()->
- DispatchEventToExtension(extension_id_, events::kOnMenuItemActivated,
- args.Pass(), profile_, GURL());
+ DispatchEventToExtension(profile_, extension_id_,
+ events::kOnMenuItemActivated, args.Pass());
}
private:
« no previous file with comments | « chrome/browser/extensions/api/idle/idle_manager.cc ('k') | chrome/browser/extensions/api/managed_mode/managed_mode_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698