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 d46e05f867ec08594d42aa179dc5f9ca832f2f23..5307e601da8f0d4caba70675c0ca5a705a02179c 100644 |
| --- a/chrome/browser/extensions/extension_event_router.h |
| +++ b/chrome/browser/extensions/extension_event_router.h |
| @@ -89,6 +89,15 @@ class ExtensionEventRouter : public NotificationObserver { |
| protected: |
| // Shared by DispatchEvent*. If |extension_id| is empty, the event is |
| // broadcast. |
| + // Eventually DispatchEventImpl will be called, but it may be delayed |
| + // sif the extension has a lazy background page. |
| + void MaybeDispatchEventImpl( |
| + const std::string& extension_id, |
| + const std::string& event_name, |
| + const std::string& event_args, |
| + Profile* restrict_to_profile, |
| + const std::string& cross_incognito_args, |
| + const GURL& event_url); |
| virtual void DispatchEventImpl( |
| const std::string& extension_id, |
| const std::string& event_name, |
| @@ -97,10 +106,23 @@ class ExtensionEventRouter : public NotificationObserver { |
| const std::string& cross_incognito_args, |
| const GURL& event_url); |
| + // Store the event and dispatch it when the background page is done loading. |
| + void EnqueueEvent(const std::string& extension_id, |
| + const std::string& event_name, |
| + const std::string& event_args, |
| + Profile* restrict_to_profile, |
| + const std::string& cross_incognito_args, |
| + const GURL& event_url); |
| + void DispatchPendingEvents(const std::string& extension_id); |
| + void ClearPendingEvents(const std::string& extension_id); |
| + |
| private: |
| // An extension listening to an event. |
| struct EventListener; |
| + // An event that is waiting to be dispatched. |
| + struct PendingEvent; |
| + |
| virtual void Observe(int type, |
| const NotificationSource& source, |
| const NotificationDetails& details); |
| @@ -116,6 +138,11 @@ class ExtensionEventRouter : public NotificationObserver { |
| typedef std::map<std::string, std::set<EventListener> > ListenerMap; |
| ListenerMap listeners_; |
| + // A map between an extension id and the queue of events pending |
| + // the load of it's background page. |
| + typedef std::vector<PendingEvent> PendingEventsQueue; |
|
Aaron Boodman
2011/08/18 19:25:55
You can use std::queue.
Tessa MacDuff
2011/08/18 20:49:39
Yeah, I just thought it was overkill since I never
Aaron Boodman
2011/08/18 21:19:23
ok.
Tessa MacDuff
2011/08/23 18:18:42
Done.
|
| + std::map<std::string, PendingEventsQueue> pending_events_; |
|
Aaron Boodman
2011/08/18 19:25:55
Nit: this is a bit inefficient because as these ma
Tessa MacDuff
2011/08/23 18:18:42
Done.
|
| + |
| DISALLOW_COPY_AND_ASSIGN(ExtensionEventRouter); |
| }; |