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

Unified Diff: chrome/browser/renderer_host/chrome_render_message_filter.cc

Issue 10514013: Filtered events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: split out event_filter changes Created 8 years, 6 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
Index: chrome/browser/renderer_host/chrome_render_message_filter.cc
diff --git a/chrome/browser/renderer_host/chrome_render_message_filter.cc b/chrome/browser/renderer_host/chrome_render_message_filter.cc
index 722fb1be01f968ac9f335b58b729eccd09bc6c5d..6207a9c404fca338fa87beec977122f07914cc98 100644
--- a/chrome/browser/renderer_host/chrome_render_message_filter.cc
+++ b/chrome/browser/renderer_host/chrome_render_message_filter.cc
@@ -93,6 +93,10 @@ bool ChromeRenderMessageFilter::OnMessageReceived(const IPC::Message& message,
OnExtensionAddLazyListener)
IPC_MESSAGE_HANDLER(ExtensionHostMsg_RemoveLazyListener,
OnExtensionRemoveLazyListener)
+ IPC_MESSAGE_HANDLER(ExtensionHostMsg_AddFilteredListener,
+ OnExtensionAddFilteredListener)
+ IPC_MESSAGE_HANDLER(ExtensionHostMsg_RemoveFilteredListener,
+ OnExtensionRemoveFilteredListener)
IPC_MESSAGE_HANDLER(ExtensionHostMsg_CloseChannel, OnExtensionCloseChannel)
IPC_MESSAGE_HANDLER(ExtensionHostMsg_RequestForIOThread,
OnExtensionRequestForIOThread)
@@ -143,6 +147,8 @@ void ChromeRenderMessageFilter::OverrideThreadForMessage(
case ExtensionHostMsg_RemoveListener::ID:
case ExtensionHostMsg_AddLazyListener::ID:
case ExtensionHostMsg_RemoveLazyListener::ID:
+ case ExtensionHostMsg_AddFilteredListener::ID:
+ case ExtensionHostMsg_RemoveFilteredListener::ID:
case ExtensionHostMsg_CloseChannel::ID:
case ExtensionHostMsg_ShouldUnloadAck::ID:
case ExtensionHostMsg_UnloadAck::ID:
@@ -378,6 +384,34 @@ void ChromeRenderMessageFilter::OnExtensionRemoveLazyListener(
event_name, extension_id);
}
+void ChromeRenderMessageFilter::OnExtensionAddFilteredListener(
+ const std::string& extension_id,
+ const std::string& event_name,
+ const base::DictionaryValue& filter,
+ bool lazy) {
+ content::RenderProcessHost* process =
+ content::RenderProcessHost::FromID(render_process_id_);
+ if (!process || !profile_->GetExtensionEventRouter())
+ return;
+
+ profile_->GetExtensionEventRouter()->AddFilteredEventListener(
+ event_name, process, extension_id, filter, lazy);
+}
+
+void ChromeRenderMessageFilter::OnExtensionRemoveFilteredListener(
+ const std::string& extension_id,
+ const std::string& event_name,
+ const base::DictionaryValue& filter,
+ bool lazy) {
+ content::RenderProcessHost* process =
+ content::RenderProcessHost::FromID(render_process_id_);
+ if (!process || !profile_->GetExtensionEventRouter())
+ return;
+
+ profile_->GetExtensionEventRouter()->RemoveFilteredEventListener(
+ event_name, process, extension_id, filter, lazy);
+}
+
void ChromeRenderMessageFilter::OnExtensionCloseChannel(int port_id,
bool connection_error) {
if (!content::RenderProcessHost::FromID(render_process_id_))

Powered by Google App Engine
This is Rietveld 408576698