Chromium Code Reviews| Index: chrome/browser/extensions/extension_event_router.h |
| diff --git a/chrome/browser/extensions/extension_event_router.h b/chrome/browser/extensions/extension_event_router.h |
| index 2b52cc812bae9e6b4526fa6f8307338eb1525cf7..a08d816fdb14cdd8d90f90fa8476f5a93507bb90 100644 |
| --- a/chrome/browser/extensions/extension_event_router.h |
| +++ b/chrome/browser/extensions/extension_event_router.h |
| @@ -15,6 +15,7 @@ |
| #include "base/memory/ref_counted.h" |
| #include "content/public/browser/notification_observer.h" |
| #include "content/public/browser/notification_registrar.h" |
| +#include "chrome/common/extensions/feature.h" |
| #include "ipc/ipc_message.h" |
| class GURL; |
| @@ -23,6 +24,8 @@ class ExtensionHost; |
| class ExtensionDevToolsManager; |
| class Profile; |
| +using extensions::Feature; |
| + |
| namespace content { |
| class RenderProcessHost; |
| } |
| @@ -54,8 +57,9 @@ class ExtensionEventRouter : public content::NotificationObserver { |
| // collapsing. Also, a single extension can have 2 processes if it is a split |
| // mode extension. |
| void AddEventListener(const std::string& event_name, |
| + const std::string& extension_id, |
| content::RenderProcessHost* process, |
| - const std::string& extension_id); |
| + Feature::Context context); |
| void RemoveEventListener(const std::string& event_name, |
| content::RenderProcessHost* process, |
| const std::string& extension_id); |
| @@ -65,6 +69,12 @@ class ExtensionEventRouter : public content::NotificationObserver { |
| // remembered even after the process goes away. We use this list to decide |
| // which extension pages to load when dispatching an event. |
| void AddLazyEventListener(const std::string& event_name, |
| + const std::string& extension_id, |
| + content::RenderProcessHost* process, |
| + Feature::Context context); |
| + // Use this overload when subscribing extensions to events from C++, or when |
| + // access checking the calling process and context is not required. |
| + void AddLazyEventListener(const std::string& event_name, |
|
Matt Perry
2012/04/09 20:55:54
I think ExtensionEventRouter is the only caller of
Aaron Boodman
2012/04/11 21:51:54
No, runtime_api.cc calls it.
|
| const std::string& extension_id); |
| void RemoveLazyEventListener(const std::string& event_name, |
| const std::string& extension_id); |
| @@ -131,6 +141,12 @@ class ExtensionEventRouter : public content::NotificationObserver { |
| // event. |
| struct ListenerProcess; |
| + // Helper that returns whether the event is accessible to the calling context. |
| + bool IsEventAvailable(const std::string& event_name, |
| + const std::string& extension_id, |
| + content::RenderProcessHost* render_process, |
| + Feature::Context context_type) const; |
| + |
| // A map between an event name and a set of extensions that are listening |
| // to that event. |
| typedef std::map<std::string, std::set<ListenerProcess> > ListenerMap; |