[email protected] | 9e6720a | 2012-01-24 02:30:56 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 2c69965 | 2010-10-15 18:22:41 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | 3442353 | 2013-11-21 18:13:10 | [diff] [blame] | 5 | #ifndef EXTENSIONS_BROWSER_EVENT_ROUTER_H_ |
| 6 | #define EXTENSIONS_BROWSER_EVENT_ROUTER_H_ |
[email protected] | 2c69965 | 2010-10-15 18:22:41 | [diff] [blame] | 7 | |
[email protected] | 2c69965 | 2010-10-15 18:22:41 | [diff] [blame] | 8 | #include <set> |
| 9 | #include <string> |
thestig | 7ade5b5 | 2017-05-23 23:13:36 | [diff] [blame] | 10 | #include <unordered_map> |
[email protected] | 2c69965 | 2010-10-15 18:22:41 | [diff] [blame] | 11 | |
[email protected] | 6e85092 | 2012-12-05 03:22:48 | [diff] [blame] | 12 | #include "base/callback.h" |
[email protected] | 1790275 | 2011-08-31 22:52:54 | [diff] [blame] | 13 | #include "base/compiler_specific.h" |
avi | c9cec10 | 2015-12-23 00:39:26 | [diff] [blame] | 14 | #include "base/macros.h" |
[email protected] | 3b63f8f4 | 2011-03-28 01:54:15 | [diff] [blame] | 15 | #include "base/memory/ref_counted.h" |
lazyboy | e464732f | 2017-06-15 21:17:27 | [diff] [blame] | 16 | #include "base/memory/weak_ptr.h" |
Devlin Cronin | ffbd2fe2 | 2018-07-20 17:20:17 | [diff] [blame] | 17 | #include "base/observer_list.h" |
[email protected] | 4243f9a | 2014-08-04 18:53:12 | [diff] [blame] | 18 | #include "base/scoped_observer.h" |
[email protected] | 8a16a03 | 2012-06-18 19:37:31 | [diff] [blame] | 19 | #include "base/values.h" |
juncai | cf52333 | 2015-06-04 00:14:04 | [diff] [blame] | 20 | #include "components/keyed_service/core/keyed_service.h" |
amistry | 69e9ee42 | 2015-05-22 07:40:25 | [diff] [blame] | 21 | #include "content/public/browser/render_process_host_observer.h" |
[email protected] | a0e26d4 | 2013-11-20 07:04:04 | [diff] [blame] | 22 | #include "extensions/browser/event_listener_map.h" |
Istiaque Ahmed | a14ec48 | 2018-08-25 01:02:18 | [diff] [blame] | 23 | #include "extensions/browser/events/event_ack_data.h" |
lazyboy | 75b9def | 2017-06-06 18:56:59 | [diff] [blame] | 24 | #include "extensions/browser/events/lazy_event_dispatch_util.h" |
kalman | f1b4d78 | 2015-06-24 21:14:05 | [diff] [blame] | 25 | #include "extensions/browser/extension_event_histogram_value.h" |
Evan Stade | 922f3f1f | 2019-09-04 21:05:13 | [diff] [blame] | 26 | #include "extensions/browser/extension_registry.h" |
[email protected] | 4243f9a | 2014-08-04 18:53:12 | [diff] [blame] | 27 | #include "extensions/browser/extension_registry_observer.h" |
lazyboy | 63b994a | 2017-06-30 21:20:23 | [diff] [blame] | 28 | #include "extensions/browser/lazy_context_task_queue.h" |
lazyboy | e784724 | 2017-06-07 23:29:18 | [diff] [blame] | 29 | #include "extensions/common/constants.h" |
[email protected] | 4b3e192 | 2013-02-12 04:45:58 | [diff] [blame] | 30 | #include "extensions/common/event_filtering_info.h" |
John Lee | 6e10a460 | 2019-08-22 21:20:09 | [diff] [blame] | 31 | #include "extensions/common/features/feature.h" |
[email protected] | b44f8ad | 2012-06-15 20:52:58 | [diff] [blame] | 32 | #include "ipc/ipc_sender.h" |
kalman | a9f6e67 | 2015-08-11 00:22:50 | [diff] [blame] | 33 | #include "url/gurl.h" |
[email protected] | 2c69965 | 2010-10-15 18:22:41 | [diff] [blame] | 34 | |
| 35 | class GURL; |
Istiaque Ahmed | 9d166618 | 2017-09-21 23:58:18 | [diff] [blame] | 36 | struct ServiceWorkerIdentifier; |
[email protected] | f3b1a08 | 2011-11-18 00:34:30 | [diff] [blame] | 37 | |
| 38 | namespace content { |
[email protected] | 7061be9 | 2013-02-18 15:44:02 | [diff] [blame] | 39 | class BrowserContext; |
[email protected] | 2c69965 | 2010-10-15 18:22:41 | [diff] [blame] | 40 | class RenderProcessHost; |
[email protected] | f3b1a08 | 2011-11-18 00:34:30 | [diff] [blame] | 41 | } |
[email protected] | 2c69965 | 2010-10-15 18:22:41 | [diff] [blame] | 42 | |
[email protected] | 1c321ee | 2012-05-21 03:02:34 | [diff] [blame] | 43 | namespace extensions { |
| 44 | class Extension; |
[email protected] | 79cb81bb | 2012-09-20 02:23:31 | [diff] [blame] | 45 | class ExtensionPrefs; |
[email protected] | 3a1dc57 | 2012-07-31 22:25:13 | [diff] [blame] | 46 | |
[email protected] | 5a38dfd | 2012-07-23 23:22:10 | [diff] [blame] | 47 | struct Event; |
[email protected] | 954e1349 | 2012-11-15 03:18:23 | [diff] [blame] | 48 | struct EventListenerInfo; |
[email protected] | 1c321ee | 2012-05-21 03:02:34 | [diff] [blame] | 49 | |
lazyboy | e784724 | 2017-06-07 23:29:18 | [diff] [blame] | 50 | // TODO(lazyboy): Document how extension events work, including how listeners |
| 51 | // are registered and how listeners are tracked in renderer and browser process. |
juncai | cf52333 | 2015-06-04 00:14:04 | [diff] [blame] | 52 | class EventRouter : public KeyedService, |
[email protected] | 4243f9a | 2014-08-04 18:53:12 | [diff] [blame] | 53 | public ExtensionRegistryObserver, |
amistry | 69e9ee42 | 2015-05-22 07:40:25 | [diff] [blame] | 54 | public EventListenerMap::Delegate, |
| 55 | public content::RenderProcessHostObserver { |
[email protected] | 2c69965 | 2010-10-15 18:22:41 | [diff] [blame] | 56 | public: |
[email protected] | b085856f | 2012-03-02 04:37:25 | [diff] [blame] | 57 | // These constants convey the state of our knowledge of whether we're in |
| 58 | // a user-caused gesture as part of DispatchEvent. |
| 59 | enum UserGestureState { |
| 60 | USER_GESTURE_UNKNOWN = 0, |
| 61 | USER_GESTURE_ENABLED = 1, |
| 62 | USER_GESTURE_NOT_ENABLED = 2, |
| 63 | }; |
| 64 | |
[email protected] | e74d43c7 | 2013-05-17 19:01:41 | [diff] [blame] | 65 | // The pref key for the list of event names for which an extension has |
| 66 | // registered from its lazy background page. |
lazyboy | e784724 | 2017-06-07 23:29:18 | [diff] [blame] | 67 | static const char kRegisteredLazyEvents[]; |
| 68 | // The pref key for the list of event names for which an extension has |
| 69 | // registered from its service worker. |
| 70 | static const char kRegisteredServiceWorkerEvents[]; |
[email protected] | e74d43c7 | 2013-05-17 19:01:41 | [diff] [blame] | 71 | |
[email protected] | c4dc5cc | 2012-11-09 08:48:39 | [diff] [blame] | 72 | // Observers register interest in events with a particular name and are |
[email protected] | c761a96 | 2013-11-20 04:19:41 | [diff] [blame] | 73 | // notified when a listener is added or removed. Observers are matched by |
| 74 | // the base name of the event (e.g. adding an event listener for event name |
| 75 | // "foo.onBar/123" will trigger observers registered for "foo.onBar"). |
[email protected] | c4dc5cc | 2012-11-09 08:48:39 | [diff] [blame] | 76 | class Observer { |
| 77 | public: |
| 78 | // Called when a listener is added. |
[email protected] | 954e1349 | 2012-11-15 03:18:23 | [diff] [blame] | 79 | virtual void OnListenerAdded(const EventListenerInfo& details) {} |
[email protected] | c4dc5cc | 2012-11-09 08:48:39 | [diff] [blame] | 80 | // Called when a listener is removed. |
[email protected] | 954e1349 | 2012-11-15 03:18:23 | [diff] [blame] | 81 | virtual void OnListenerRemoved(const EventListenerInfo& details) {} |
thestig | 7ade5b5 | 2017-05-23 23:13:36 | [diff] [blame] | 82 | |
| 83 | protected: |
| 84 | virtual ~Observer() {} |
[email protected] | c4dc5cc | 2012-11-09 08:48:39 | [diff] [blame] | 85 | }; |
| 86 | |
Devlin Cronin | ffbd2fe2 | 2018-07-20 17:20:17 | [diff] [blame] | 87 | // A test observer to monitor event dispatching. |
| 88 | class TestObserver { |
| 89 | public: |
| 90 | virtual ~TestObserver() = default; |
| 91 | virtual void OnWillDispatchEvent(const Event& event) = 0; |
Ramin Halavati | a487022 | 2018-07-31 05:41:04 | [diff] [blame] | 92 | virtual void OnDidDispatchEventToProcess(const Event& event) = 0; |
Devlin Cronin | ffbd2fe2 | 2018-07-20 17:20:17 | [diff] [blame] | 93 | }; |
| 94 | |
[email protected] | 3a368a2 | 2014-03-26 19:29:19 | [diff] [blame] | 95 | // Gets the EventRouter for |browser_context|. |
[email protected] | 3a368a2 | 2014-03-26 19:29:19 | [diff] [blame] | 96 | static EventRouter* Get(content::BrowserContext* browser_context); |
| 97 | |
[email protected] | c761a96 | 2013-11-20 04:19:41 | [diff] [blame] | 98 | // Converts event names like "foo.onBar/123" into "foo.onBar". Event names |
| 99 | // without a "/" are returned unchanged. |
| 100 | static std::string GetBaseEventName(const std::string& full_event_name); |
| 101 | |
[email protected] | c9bd90f | 2012-08-07 23:58:15 | [diff] [blame] | 102 | // Sends an event via ipc_sender to the given extension. Can be called on any |
| 103 | // thread. |
kalman | a9f6e67 | 2015-08-11 00:22:50 | [diff] [blame] | 104 | // |
| 105 | // It is very rare to call this function directly. Instead use the instance |
| 106 | // methods BroadcastEvent or DispatchEventToExtension. |
Istiaque Ahmed | 68ef38d6 | 2019-06-15 00:23:21 | [diff] [blame] | 107 | // Note that this method will dispatch the event with |
| 108 | // UserGestureState:USER_GESTURE_UNKNOWN. |
kalman | a9f6e67 | 2015-08-11 00:22:50 | [diff] [blame] | 109 | static void DispatchEventToSender(IPC::Sender* ipc_sender, |
David Bertoni | ac5892eb | 2020-01-03 00:36:44 | [diff] [blame] | 110 | content::BrowserContext* browser_context, |
kalman | a9f6e67 | 2015-08-11 00:22:50 | [diff] [blame] | 111 | const std::string& extension_id, |
| 112 | events::HistogramValue histogram_value, |
| 113 | const std::string& event_name, |
David Bertoni | 3929f55 | 2019-03-28 22:10:36 | [diff] [blame] | 114 | int render_process_id, |
| 115 | int worker_thread_id, |
David Bertoni | fc97d5ea | 2019-03-20 04:08:39 | [diff] [blame] | 116 | int64_t service_worker_version_id, |
dcheng | f5d24108 | 2016-04-21 03:43:11 | [diff] [blame] | 117 | std::unique_ptr<base::ListValue> event_args, |
kalman | a9f6e67 | 2015-08-11 00:22:50 | [diff] [blame] | 118 | const EventFilteringInfo& info); |
[email protected] | 5a7b5eaf | 2010-11-02 20:52:19 | [diff] [blame] | 119 | |
lazyboy | e464732f | 2017-06-15 21:17:27 | [diff] [blame] | 120 | // Returns false when the event is scoped to a context and the listening |
| 121 | // extension does not have access to events from that context. |
| 122 | static bool CanDispatchEventToBrowserContext(content::BrowserContext* context, |
| 123 | const Extension* extension, |
| 124 | const Event& event); |
| 125 | |
[email protected] | 45fd9417 | 2013-11-13 03:29:52 | [diff] [blame] | 126 | // An EventRouter is shared between |browser_context| and its associated |
| 127 | // incognito context. |extension_prefs| may be NULL in tests. |
| 128 | EventRouter(content::BrowserContext* browser_context, |
| 129 | ExtensionPrefs* extension_prefs); |
dcheng | 9168b2f | 2014-10-21 12:38:24 | [diff] [blame] | 130 | ~EventRouter() override; |
[email protected] | 2c69965 | 2010-10-15 18:22:41 | [diff] [blame] | 131 | |
[email protected] | c1abb323 | 2014-07-30 18:28:39 | [diff] [blame] | 132 | // Add or remove an extension as an event listener for |event_name|. |
| 133 | // |
[email protected] | a7ab1b78 | 2010-10-21 23:24:16 | [diff] [blame] | 134 | // Note that multiple extensions can share a process due to process |
| 135 | // collapsing. Also, a single extension can have 2 processes if it is a split |
| 136 | // mode extension. |
[email protected] | 2c69965 | 2010-10-15 18:22:41 | [diff] [blame] | 137 | void AddEventListener(const std::string& event_name, |
[email protected] | f3b1a08 | 2011-11-18 00:34:30 | [diff] [blame] | 138 | content::RenderProcessHost* process, |
lazyboy | e784724 | 2017-06-07 23:29:18 | [diff] [blame] | 139 | const ExtensionId& extension_id); |
| 140 | void AddServiceWorkerEventListener(const std::string& event_name, |
| 141 | content::RenderProcessHost* process, |
| 142 | const ExtensionId& extension_id, |
lazyboy | 63b994a | 2017-06-30 21:20:23 | [diff] [blame] | 143 | const GURL& service_worker_scope, |
Istiaque Ahmed | a14ec48 | 2018-08-25 01:02:18 | [diff] [blame] | 144 | int64_t service_worker_version_id, |
lazyboy | e784724 | 2017-06-07 23:29:18 | [diff] [blame] | 145 | int worker_thread_id); |
[email protected] | 2c69965 | 2010-10-15 18:22:41 | [diff] [blame] | 146 | void RemoveEventListener(const std::string& event_name, |
[email protected] | f3b1a08 | 2011-11-18 00:34:30 | [diff] [blame] | 147 | content::RenderProcessHost* process, |
lazyboy | e784724 | 2017-06-07 23:29:18 | [diff] [blame] | 148 | const ExtensionId& extension_id); |
| 149 | void RemoveServiceWorkerEventListener(const std::string& event_name, |
| 150 | content::RenderProcessHost* process, |
| 151 | const ExtensionId& extension_id, |
lazyboy | 63b994a | 2017-06-30 21:20:23 | [diff] [blame] | 152 | const GURL& service_worker_scope, |
Istiaque Ahmed | a14ec48 | 2018-08-25 01:02:18 | [diff] [blame] | 153 | int64_t service_worker_version_id, |
lazyboy | e784724 | 2017-06-07 23:29:18 | [diff] [blame] | 154 | int worker_thread_id); |
[email protected] | 2c69965 | 2010-10-15 18:22:41 | [diff] [blame] | 155 | |
[email protected] | c1abb323 | 2014-07-30 18:28:39 | [diff] [blame] | 156 | // Add or remove a URL as an event listener for |event_name|. |
| 157 | void AddEventListenerForURL(const std::string& event_name, |
| 158 | content::RenderProcessHost* process, |
| 159 | const GURL& listener_url); |
| 160 | void RemoveEventListenerForURL(const std::string& event_name, |
| 161 | content::RenderProcessHost* process, |
| 162 | const GURL& listener_url); |
| 163 | |
[email protected] | f34706b | 2012-09-04 07:32:09 | [diff] [blame] | 164 | EventListenerMap& listeners() { return listeners_; } |
| 165 | |
[email protected] | c4dc5cc | 2012-11-09 08:48:39 | [diff] [blame] | 166 | // Registers an observer to be notified when an event listener for |
| 167 | // |event_name| is added or removed. There can currently be only one observer |
| 168 | // for each distinct |event_name|. |
thestig | 7ade5b5 | 2017-05-23 23:13:36 | [diff] [blame] | 169 | void RegisterObserver(Observer* observer, const std::string& event_name); |
[email protected] | c4dc5cc | 2012-11-09 08:48:39 | [diff] [blame] | 170 | |
| 171 | // Unregisters an observer from all events. |
| 172 | void UnregisterObserver(Observer* observer); |
| 173 | |
Devlin Cronin | ffbd2fe2 | 2018-07-20 17:20:17 | [diff] [blame] | 174 | // Adds/removes test observers. |
| 175 | void AddObserverForTesting(TestObserver* observer); |
| 176 | void RemoveObserverForTesting(TestObserver* observer); |
| 177 | |
[email protected] | 3653122 | 2012-02-07 19:41:27 | [diff] [blame] | 178 | // Add or remove the extension as having a lazy background page that listens |
| 179 | // to the event. The difference from the above methods is that these will be |
| 180 | // remembered even after the process goes away. We use this list to decide |
| 181 | // which extension pages to load when dispatching an event. |
| 182 | void AddLazyEventListener(const std::string& event_name, |
lazyboy | e784724 | 2017-06-07 23:29:18 | [diff] [blame] | 183 | const ExtensionId& extension_id); |
[email protected] | 3653122 | 2012-02-07 19:41:27 | [diff] [blame] | 184 | void RemoveLazyEventListener(const std::string& event_name, |
lazyboy | e784724 | 2017-06-07 23:29:18 | [diff] [blame] | 185 | const ExtensionId& extension_id); |
| 186 | // Similar to Add/RemoveLazyEventListener, but applies to extension service |
| 187 | // workers. |
| 188 | void AddLazyServiceWorkerEventListener(const std::string& event_name, |
| 189 | const ExtensionId& extension_id, |
lazyboy | 63b994a | 2017-06-30 21:20:23 | [diff] [blame] | 190 | const GURL& service_worker_scope); |
lazyboy | e784724 | 2017-06-07 23:29:18 | [diff] [blame] | 191 | void RemoveLazyServiceWorkerEventListener(const std::string& event_name, |
| 192 | const ExtensionId& extension_id, |
lazyboy | 63b994a | 2017-06-30 21:20:23 | [diff] [blame] | 193 | const GURL& service_worker_scope); |
[email protected] | 3653122 | 2012-02-07 19:41:27 | [diff] [blame] | 194 | |
[email protected] | d9e559d | 2012-07-05 01:04:57 | [diff] [blame] | 195 | // If |add_lazy_listener| is true also add the lazy version of this listener. |
Istiaque Ahmed | 9d166618 | 2017-09-21 23:58:18 | [diff] [blame] | 196 | void AddFilteredEventListener( |
| 197 | const std::string& event_name, |
| 198 | content::RenderProcessHost* process, |
| 199 | const std::string& extension_id, |
| 200 | base::Optional<ServiceWorkerIdentifier> sw_identifier, |
| 201 | const base::DictionaryValue& filter, |
| 202 | bool add_lazy_listener); |
[email protected] | d9e559d | 2012-07-05 01:04:57 | [diff] [blame] | 203 | |
| 204 | // If |remove_lazy_listener| is true also remove the lazy version of this |
| 205 | // listener. |
Istiaque Ahmed | 9d166618 | 2017-09-21 23:58:18 | [diff] [blame] | 206 | void RemoveFilteredEventListener( |
| 207 | const std::string& event_name, |
| 208 | content::RenderProcessHost* process, |
| 209 | const std::string& extension_id, |
| 210 | base::Optional<ServiceWorkerIdentifier> sw_identifier, |
| 211 | const base::DictionaryValue& filter, |
| 212 | bool remove_lazy_listener); |
[email protected] | d9e559d | 2012-07-05 01:04:57 | [diff] [blame] | 213 | |
[email protected] | 2c69965 | 2010-10-15 18:22:41 | [diff] [blame] | 214 | // Returns true if there is at least one listener for the given event. |
thestig | 7ade5b5 | 2017-05-23 23:13:36 | [diff] [blame] | 215 | bool HasEventListener(const std::string& event_name) const; |
[email protected] | 2c69965 | 2010-10-15 18:22:41 | [diff] [blame] | 216 | |
[email protected] | a7ab1b78 | 2010-10-21 23:24:16 | [diff] [blame] | 217 | // Returns true if the extension is listening to the given event. |
thestig | 7ade5b5 | 2017-05-23 23:13:36 | [diff] [blame] | 218 | // (virtual for testing only.) |
asargent | d50b18c | 2016-04-21 01:17:16 | [diff] [blame] | 219 | virtual bool ExtensionHasEventListener(const std::string& extension_id, |
thestig | 7ade5b5 | 2017-05-23 23:13:36 | [diff] [blame] | 220 | const std::string& event_name) const; |
[email protected] | a7ab1b78 | 2010-10-21 23:24:16 | [diff] [blame] | 221 | |
[email protected] | 6e85092 | 2012-12-05 03:22:48 | [diff] [blame] | 222 | // Broadcasts an event to every listener registered for that event. |
dcheng | f5d24108 | 2016-04-21 03:43:11 | [diff] [blame] | 223 | virtual void BroadcastEvent(std::unique_ptr<Event> event); |
[email protected] | 6e85092 | 2012-12-05 03:22:48 | [diff] [blame] | 224 | |
| 225 | // Dispatches an event to the given extension. |
| 226 | virtual void DispatchEventToExtension(const std::string& extension_id, |
dcheng | f5d24108 | 2016-04-21 03:43:11 | [diff] [blame] | 227 | std::unique_ptr<Event> event); |
[email protected] | 6e85092 | 2012-12-05 03:22:48 | [diff] [blame] | 228 | |
[email protected] | 42d2474 | 2013-07-23 05:25:55 | [diff] [blame] | 229 | // Dispatches |event| to the given extension as if the extension has a lazy |
| 230 | // listener for it. NOTE: This should be used rarely, for dispatching events |
| 231 | // to extensions that haven't had a chance to add their own listeners yet, eg: |
| 232 | // newly installed extensions. |
| 233 | void DispatchEventWithLazyListener(const std::string& extension_id, |
dcheng | f5d24108 | 2016-04-21 03:43:11 | [diff] [blame] | 234 | std::unique_ptr<Event> event); |
[email protected] | 42d2474 | 2013-07-23 05:25:55 | [diff] [blame] | 235 | |
[email protected] | 8910201 | 2011-11-01 21:23:56 | [diff] [blame] | 236 | // Record the Event Ack from the renderer. (One less event in-flight.) |
[email protected] | 45fd9417 | 2013-11-13 03:29:52 | [diff] [blame] | 237 | void OnEventAck(content::BrowserContext* context, |
David Bertoni | 3e1e9fa | 2018-08-29 20:39:30 | [diff] [blame] | 238 | const std::string& extension_id, |
| 239 | const std::string& event_name); |
[email protected] | 8910201 | 2011-11-01 21:23:56 | [diff] [blame] | 240 | |
lazyboy | ac96891 | 2017-05-16 17:50:09 | [diff] [blame] | 241 | // Returns whether or not the given extension has any registered events. |
Istiaque Ahmed | 805f6a83b | 2017-10-05 01:23:26 | [diff] [blame] | 242 | bool HasRegisteredEvents(const ExtensionId& extension_id) const; |
lazyboy | ac96891 | 2017-05-16 17:50:09 | [diff] [blame] | 243 | |
| 244 | // Clears registered events for testing purposes. |
lazyboy | e784724 | 2017-06-07 23:29:18 | [diff] [blame] | 245 | void ClearRegisteredEventsForTest(const ExtensionId& extension_id); |
lazyboy | ac96891 | 2017-05-16 17:50:09 | [diff] [blame] | 246 | |
kalman | a9f6e67 | 2015-08-11 00:22:50 | [diff] [blame] | 247 | // Reports UMA for an event dispatched to |extension| with histogram value |
| 248 | // |histogram_value|. Must be called on the UI thread. |
| 249 | // |
| 250 | // |did_enqueue| should be true if the event was queued waiting for a process |
| 251 | // to start, like an event page. |
| 252 | void ReportEvent(events::HistogramValue histogram_value, |
| 253 | const Extension* extension, |
| 254 | bool did_enqueue); |
| 255 | |
lazyboy | 75b9def | 2017-06-06 18:56:59 | [diff] [blame] | 256 | LazyEventDispatchUtil* lazy_event_dispatch_util() { |
| 257 | return &lazy_event_dispatch_util_; |
| 258 | } |
| 259 | |
Istiaque Ahmed | a14ec48 | 2018-08-25 01:02:18 | [diff] [blame] | 260 | EventAckData* event_ack_data() { return &event_ack_data_; } |
| 261 | |
Devlin Cronin | 6e1ee26 | 2017-10-05 01:38:34 | [diff] [blame] | 262 | // Returns true if there is a registered lazy/non-lazy listener for the given |
rdevlin.cronin | 91f0c8a3 | 2017-07-19 21:26:33 | [diff] [blame] | 263 | // |event_name|. |
| 264 | bool HasLazyEventListenerForTesting(const std::string& event_name); |
Devlin Cronin | 6e1ee26 | 2017-10-05 01:38:34 | [diff] [blame] | 265 | bool HasNonLazyEventListenerForTesting(const std::string& event_name); |
rdevlin.cronin | 91f0c8a3 | 2017-07-19 21:26:33 | [diff] [blame] | 266 | |
[email protected] | fb6ff23b | 2012-03-13 23:13:42 | [diff] [blame] | 267 | private: |
lazyboy | 348e5ca | 2016-12-05 21:43:29 | [diff] [blame] | 268 | friend class EventRouterFilterTest; |
[email protected] | c1abb323 | 2014-07-30 18:28:39 | [diff] [blame] | 269 | friend class EventRouterTest; |
[email protected] | c761a96 | 2013-11-20 04:19:41 | [diff] [blame] | 270 | |
lazyboy | e784724 | 2017-06-07 23:29:18 | [diff] [blame] | 271 | enum class RegisteredEventType { |
| 272 | kLazy, |
| 273 | kServiceWorker, |
| 274 | }; |
| 275 | |
[email protected] | c9bd90f | 2012-08-07 23:58:15 | [diff] [blame] | 276 | // TODO(gdk): Document this. |
| 277 | static void DispatchExtensionMessage( |
| 278 | IPC::Sender* ipc_sender, |
lazyboy | e784724 | 2017-06-07 23:29:18 | [diff] [blame] | 279 | int worker_thread_id, |
David Bertoni | ac5892eb | 2020-01-03 00:36:44 | [diff] [blame] | 280 | content::BrowserContext* browser_context, |
[email protected] | c9bd90f | 2012-08-07 23:58:15 | [diff] [blame] | 281 | const std::string& extension_id, |
chirantan | 669993c | 2015-03-05 23:38:33 | [diff] [blame] | 282 | int event_id, |
[email protected] | c9bd90f | 2012-08-07 23:58:15 | [diff] [blame] | 283 | const std::string& event_name, |
| 284 | base::ListValue* event_args, |
[email protected] | c9bd90f | 2012-08-07 23:58:15 | [diff] [blame] | 285 | UserGestureState user_gesture, |
| 286 | const extensions::EventFilteringInfo& info); |
| 287 | |
lazyboy | ac96891 | 2017-05-16 17:50:09 | [diff] [blame] | 288 | // Returns or sets the list of events for which the given extension has |
| 289 | // registered. |
lazyboy | e784724 | 2017-06-07 23:29:18 | [diff] [blame] | 290 | std::set<std::string> GetRegisteredEvents(const std::string& extension_id, |
| 291 | RegisteredEventType type) const; |
lazyboy | ac96891 | 2017-05-16 17:50:09 | [diff] [blame] | 292 | void SetRegisteredEvents(const std::string& extension_id, |
lazyboy | e784724 | 2017-06-07 23:29:18 | [diff] [blame] | 293 | const std::set<std::string>& events, |
| 294 | RegisteredEventType type); |
lazyboy | ac96891 | 2017-05-16 17:50:09 | [diff] [blame] | 295 | |
[email protected] | 4243f9a | 2014-08-04 18:53:12 | [diff] [blame] | 296 | // ExtensionRegistryObserver implementation. |
dcheng | 9168b2f | 2014-10-21 12:38:24 | [diff] [blame] | 297 | void OnExtensionLoaded(content::BrowserContext* browser_context, |
| 298 | const Extension* extension) override; |
| 299 | void OnExtensionUnloaded(content::BrowserContext* browser_context, |
| 300 | const Extension* extension, |
limasdf | 0deef204 | 2017-05-03 19:17:17 | [diff] [blame] | 301 | UnloadedExtensionReason reason) override; |
[email protected] | 2c69965 | 2010-10-15 18:22:41 | [diff] [blame] | 302 | |
lazyboy | 63b994a | 2017-06-30 21:20:23 | [diff] [blame] | 303 | void AddLazyEventListenerImpl(std::unique_ptr<EventListener> listener, |
| 304 | RegisteredEventType type); |
| 305 | void RemoveLazyEventListenerImpl(std::unique_ptr<EventListener> listener, |
| 306 | RegisteredEventType type); |
lazyboy | e784724 | 2017-06-07 23:29:18 | [diff] [blame] | 307 | |
kalman | a9f6e67 | 2015-08-11 00:22:50 | [diff] [blame] | 308 | // Shared by all event dispatch methods. If |restrict_to_extension_id| is |
| 309 | // empty, the event is broadcast. An event that just came off the pending |
| 310 | // list may not be delayed again. |
[email protected] | d9e559d | 2012-07-05 01:04:57 | [diff] [blame] | 311 | void DispatchEventImpl(const std::string& restrict_to_extension_id, |
Devlin Cronin | 6db7057 | 2018-12-21 23:23:24 | [diff] [blame] | 312 | std::unique_ptr<Event> event); |
[email protected] | fb6ff23b | 2012-03-13 23:13:42 | [diff] [blame] | 313 | |
[email protected] | c1abb323 | 2014-07-30 18:28:39 | [diff] [blame] | 314 | // Dispatches the event to the specified extension or URL running in |
| 315 | // |process|. |
[email protected] | d9e559d | 2012-07-05 01:04:57 | [diff] [blame] | 316 | void DispatchEventToProcess(const std::string& extension_id, |
[email protected] | c1abb323 | 2014-07-30 18:28:39 | [diff] [blame] | 317 | const GURL& listener_url, |
[email protected] | d9e559d | 2012-07-05 01:04:57 | [diff] [blame] | 318 | content::RenderProcessHost* process, |
Istiaque Ahmed | a14ec48 | 2018-08-25 01:02:18 | [diff] [blame] | 319 | int64_t service_worker_version_id, |
lazyboy | e784724 | 2017-06-07 23:29:18 | [diff] [blame] | 320 | int worker_thread_id, |
Devlin Cronin | 6db7057 | 2018-12-21 23:23:24 | [diff] [blame] | 321 | Event* event, |
kalman | a9f6e67 | 2015-08-11 00:22:50 | [diff] [blame] | 322 | const base::DictionaryValue* listener_filter, |
| 323 | bool did_enqueue); |
[email protected] | fb6ff23b | 2012-03-13 23:13:42 | [diff] [blame] | 324 | |
[email protected] | e74d43c7 | 2013-05-17 19:01:41 | [diff] [blame] | 325 | // Adds a filter to an event. |
| 326 | void AddFilterToEvent(const std::string& event_name, |
| 327 | const std::string& extension_id, |
Istiaque Ahmed | 9ce21b3 | 2017-10-10 20:43:18 | [diff] [blame] | 328 | bool is_for_service_worker, |
[email protected] | e74d43c7 | 2013-05-17 19:01:41 | [diff] [blame] | 329 | const base::DictionaryValue* filter); |
| 330 | |
| 331 | // Removes a filter from an event. |
| 332 | void RemoveFilterFromEvent(const std::string& event_name, |
| 333 | const std::string& extension_id, |
Istiaque Ahmed | 9ce21b3 | 2017-10-10 20:43:18 | [diff] [blame] | 334 | bool is_for_service_worker, |
[email protected] | e74d43c7 | 2013-05-17 19:01:41 | [diff] [blame] | 335 | const base::DictionaryValue* filter); |
| 336 | |
| 337 | // Returns the dictionary of event filters that the given extension has |
| 338 | // registered. |
| 339 | const base::DictionaryValue* GetFilteredEvents( |
Istiaque Ahmed | 9ce21b3 | 2017-10-10 20:43:18 | [diff] [blame] | 340 | const std::string& extension_id, |
| 341 | RegisteredEventType type); |
[email protected] | e74d43c7 | 2013-05-17 19:01:41 | [diff] [blame] | 342 | |
chirantan | 669993c | 2015-03-05 23:38:33 | [diff] [blame] | 343 | // Track the dispatched events that have not yet sent an ACK from the |
| 344 | // renderer. |
[email protected] | 45fd9417 | 2013-11-13 03:29:52 | [diff] [blame] | 345 | void IncrementInFlightEvents(content::BrowserContext* context, |
David Bertoni | fc97d5ea | 2019-03-20 04:08:39 | [diff] [blame] | 346 | content::RenderProcessHost* process, |
chirantan | 669993c | 2015-03-05 23:38:33 | [diff] [blame] | 347 | const Extension* extension, |
| 348 | int event_id, |
David Bertoni | fc97d5ea | 2019-03-20 04:08:39 | [diff] [blame] | 349 | const std::string& event_name, |
| 350 | int64_t service_worker_version_id); |
[email protected] | fb6ff23b | 2012-03-13 23:13:42 | [diff] [blame] | 351 | |
[email protected] | db9f214 | 2013-05-27 22:56:16 | [diff] [blame] | 352 | // static |
David Bertoni | ac5892eb | 2020-01-03 00:36:44 | [diff] [blame] | 353 | static void DoDispatchEventToSenderBookkeeping( |
| 354 | content::BrowserContext* context, |
kalman | a9f6e67 | 2015-08-11 00:22:50 | [diff] [blame] | 355 | const std::string& extension_id, |
| 356 | int event_id, |
David Bertoni | 3929f55 | 2019-03-28 22:10:36 | [diff] [blame] | 357 | int render_process_id, |
David Bertoni | fc97d5ea | 2019-03-20 04:08:39 | [diff] [blame] | 358 | int64_t service_worker_version_id, |
kalman | a9f6e67 | 2015-08-11 00:22:50 | [diff] [blame] | 359 | events::HistogramValue histogram_value, |
| 360 | const std::string& event_name); |
[email protected] | db9f214 | 2013-05-27 22:56:16 | [diff] [blame] | 361 | |
lazyboy | 63b994a | 2017-06-30 21:20:23 | [diff] [blame] | 362 | void DispatchPendingEvent( |
Devlin Cronin | 6db7057 | 2018-12-21 23:23:24 | [diff] [blame] | 363 | std::unique_ptr<Event> event, |
lazyboy | 63b994a | 2017-06-30 21:20:23 | [diff] [blame] | 364 | std::unique_ptr<LazyContextTaskQueue::ContextInfo> params); |
[email protected] | fb6ff23b | 2012-03-13 23:13:42 | [diff] [blame] | 365 | |
[email protected] | 5a38dfd | 2012-07-23 23:22:10 | [diff] [blame] | 366 | // Implementation of EventListenerMap::Delegate. |
dcheng | 9168b2f | 2014-10-21 12:38:24 | [diff] [blame] | 367 | void OnListenerAdded(const EventListener* listener) override; |
| 368 | void OnListenerRemoved(const EventListener* listener) override; |
[email protected] | d9e559d | 2012-07-05 01:04:57 | [diff] [blame] | 369 | |
amistry | 69e9ee42 | 2015-05-22 07:40:25 | [diff] [blame] | 370 | // RenderProcessHostObserver implementation. |
Bo Liu | 2a48940 | 2018-04-24 23:41:27 | [diff] [blame] | 371 | void RenderProcessExited( |
| 372 | content::RenderProcessHost* host, |
| 373 | const content::ChildProcessTerminationInfo& info) override; |
amistry | 69e9ee42 | 2015-05-22 07:40:25 | [diff] [blame] | 374 | void RenderProcessHostDestroyed(content::RenderProcessHost* host) override; |
| 375 | |
thestig | 7ade5b5 | 2017-05-23 23:13:36 | [diff] [blame] | 376 | content::BrowserContext* const browser_context_; |
[email protected] | 45fd9417 | 2013-11-13 03:29:52 | [diff] [blame] | 377 | |
[email protected] | 513b803 | 2013-11-18 07:47:49 | [diff] [blame] | 378 | // The ExtensionPrefs associated with |browser_context_|. May be NULL in |
| 379 | // tests. |
thestig | 7ade5b5 | 2017-05-23 23:13:36 | [diff] [blame] | 380 | ExtensionPrefs* const extension_prefs_; |
[email protected] | 2c69965 | 2010-10-15 18:22:41 | [diff] [blame] | 381 | |
[email protected] | 4243f9a | 2014-08-04 18:53:12 | [diff] [blame] | 382 | ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
Evan Stade | 922f3f1f | 2019-09-04 21:05:13 | [diff] [blame] | 383 | extension_registry_observer_{this}; |
[email protected] | 4243f9a | 2014-08-04 18:53:12 | [diff] [blame] | 384 | |
Evan Stade | 922f3f1f | 2019-09-04 21:05:13 | [diff] [blame] | 385 | EventListenerMap listeners_{this}; |
[email protected] | 58c9095 | 2012-11-09 00:03:30 | [diff] [blame] | 386 | |
[email protected] | c761a96 | 2013-11-20 04:19:41 | [diff] [blame] | 387 | // Map from base event name to observer. |
thestig | 7ade5b5 | 2017-05-23 23:13:36 | [diff] [blame] | 388 | using ObserverMap = std::unordered_map<std::string, Observer*>; |
[email protected] | c4dc5cc | 2012-11-09 08:48:39 | [diff] [blame] | 389 | ObserverMap observers_; |
| 390 | |
Trent Apted | a250ec3ab | 2018-08-19 08:52:19 | [diff] [blame] | 391 | base::ObserverList<TestObserver>::Unchecked test_observers_; |
Devlin Cronin | ffbd2fe2 | 2018-07-20 17:20:17 | [diff] [blame] | 392 | |
amistry | 69e9ee42 | 2015-05-22 07:40:25 | [diff] [blame] | 393 | std::set<content::RenderProcessHost*> observed_process_set_; |
| 394 | |
lazyboy | 75b9def | 2017-06-06 18:56:59 | [diff] [blame] | 395 | LazyEventDispatchUtil lazy_event_dispatch_util_; |
| 396 | |
Istiaque Ahmed | a14ec48 | 2018-08-25 01:02:18 | [diff] [blame] | 397 | EventAckData event_ack_data_; |
| 398 | |
Jeremy Roman | 9fc2de6 | 2019-07-12 14:15:03 | [diff] [blame] | 399 | base::WeakPtrFactory<EventRouter> weak_factory_{this}; |
lazyboy | e464732f | 2017-06-15 21:17:27 | [diff] [blame] | 400 | |
[email protected] | 5a38dfd | 2012-07-23 23:22:10 | [diff] [blame] | 401 | DISALLOW_COPY_AND_ASSIGN(EventRouter); |
[email protected] | 2c69965 | 2010-10-15 18:22:41 | [diff] [blame] | 402 | }; |
| 403 | |
[email protected] | 5a38dfd | 2012-07-23 23:22:10 | [diff] [blame] | 404 | struct Event { |
reillyg | 5464e7e | 2014-12-11 00:35:08 | [diff] [blame] | 405 | // This callback should return true if the event should be dispatched to the |
| 406 | // given context and extension, and false otherwise. |
thestig | 7ade5b5 | 2017-05-23 23:13:36 | [diff] [blame] | 407 | using WillDispatchCallback = |
Devlin Cronin | 66bfdb8 | 2018-12-27 23:54:42 | [diff] [blame] | 408 | base::RepeatingCallback<bool(content::BrowserContext*, |
John Lee | 6e10a460 | 2019-08-22 21:20:09 | [diff] [blame] | 409 | Feature::Context, |
Devlin Cronin | 66bfdb8 | 2018-12-27 23:54:42 | [diff] [blame] | 410 | const Extension*, |
| 411 | Event*, |
| 412 | const base::DictionaryValue*)>; |
[email protected] | 6e85092 | 2012-12-05 03:22:48 | [diff] [blame] | 413 | |
kalman | f1b4d78 | 2015-06-24 21:14:05 | [diff] [blame] | 414 | // The identifier for the event, for histograms. In most cases this |
| 415 | // correlates 1:1 with |event_name|, in some cases events will generate |
| 416 | // their own names, but they cannot generate their own identifier. |
thestig | 7ade5b5 | 2017-05-23 23:13:36 | [diff] [blame] | 417 | const events::HistogramValue histogram_value; |
kalman | f1b4d78 | 2015-06-24 21:14:05 | [diff] [blame] | 418 | |
[email protected] | 6e85092 | 2012-12-05 03:22:48 | [diff] [blame] | 419 | // The event to dispatch. |
thestig | 7ade5b5 | 2017-05-23 23:13:36 | [diff] [blame] | 420 | const std::string event_name; |
[email protected] | 6e85092 | 2012-12-05 03:22:48 | [diff] [blame] | 421 | |
| 422 | // Arguments to send to the event listener. |
dcheng | f5d24108 | 2016-04-21 03:43:11 | [diff] [blame] | 423 | std::unique_ptr<base::ListValue> event_args; |
[email protected] | 6e85092 | 2012-12-05 03:22:48 | [diff] [blame] | 424 | |
lazyboy | 59155a4 | 2017-05-24 22:23:35 | [diff] [blame] | 425 | // If non-null, then the event will not be sent to other BrowserContexts |
[email protected] | 45fd9417 | 2013-11-13 03:29:52 | [diff] [blame] | 426 | // unless the extension has permission (e.g. incognito tab update -> normal |
| 427 | // tab only works if extension is allowed incognito access). |
lazyboy | 59155a4 | 2017-05-24 22:23:35 | [diff] [blame] | 428 | content::BrowserContext* const restrict_to_browser_context; |
[email protected] | 6e85092 | 2012-12-05 03:22:48 | [diff] [blame] | 429 | |
| 430 | // If not empty, the event is only sent to extensions with host permissions |
| 431 | // for this url. |
| 432 | GURL event_url; |
| 433 | |
| 434 | // Whether a user gesture triggered the event. |
[email protected] | 5a38dfd | 2012-07-23 23:22:10 | [diff] [blame] | 435 | EventRouter::UserGestureState user_gesture; |
[email protected] | 6e85092 | 2012-12-05 03:22:48 | [diff] [blame] | 436 | |
| 437 | // Extra information used to filter which events are sent to the listener. |
| 438 | EventFilteringInfo filter_info; |
| 439 | |
| 440 | // If specified, this is called before dispatching an event to each |
| 441 | // extension. The third argument is a mutable reference to event_args, |
| 442 | // allowing the caller to provide different arguments depending on the |
| 443 | // extension and profile. This is guaranteed to be called synchronously with |
| 444 | // DispatchEvent, so callers don't need to worry about lifetime. |
[email protected] | 2c6e3b04c | 2014-07-24 12:48:09 | [diff] [blame] | 445 | // |
| 446 | // NOTE: the Extension argument to this may be NULL because it's possible for |
| 447 | // this event to be dispatched to non-extension processes, like WebUI. |
[email protected] | 6e85092 | 2012-12-05 03:22:48 | [diff] [blame] | 448 | WillDispatchCallback will_dispatch_callback; |
| 449 | |
lazyboy | 59155a4 | 2017-05-24 22:23:35 | [diff] [blame] | 450 | // TODO(lazyboy): This sets |restrict_to_browser_context| to nullptr, this |
| 451 | // will dispatch the event to unrelated profiles, not just incognito. Audit |
| 452 | // and limit usages of this constructor and introduce "include incognito" |
| 453 | // option to a constructor version for clients that need to disptach events to |
| 454 | // related browser_contexts. See https://crbug.com/726022. |
kalman | f1b4d78 | 2015-06-24 21:14:05 | [diff] [blame] | 455 | Event(events::HistogramValue histogram_value, |
| 456 | const std::string& event_name, |
dcheng | f5d24108 | 2016-04-21 03:43:11 | [diff] [blame] | 457 | std::unique_ptr<base::ListValue> event_args); |
[email protected] | d9e559d | 2012-07-05 01:04:57 | [diff] [blame] | 458 | |
kalman | f1b4d78 | 2015-06-24 21:14:05 | [diff] [blame] | 459 | Event(events::HistogramValue histogram_value, |
| 460 | const std::string& event_name, |
dcheng | f5d24108 | 2016-04-21 03:43:11 | [diff] [blame] | 461 | std::unique_ptr<base::ListValue> event_args, |
[email protected] | 45fd9417 | 2013-11-13 03:29:52 | [diff] [blame] | 462 | content::BrowserContext* restrict_to_browser_context); |
[email protected] | f0eb58a | 2012-12-17 22:10:49 | [diff] [blame] | 463 | |
kalman | f1b4d78 | 2015-06-24 21:14:05 | [diff] [blame] | 464 | Event(events::HistogramValue histogram_value, |
| 465 | const std::string& event_name, |
dcheng | f5d24108 | 2016-04-21 03:43:11 | [diff] [blame] | 466 | std::unique_ptr<base::ListValue> event_args, |
[email protected] | 45fd9417 | 2013-11-13 03:29:52 | [diff] [blame] | 467 | content::BrowserContext* restrict_to_browser_context, |
[email protected] | 6e85092 | 2012-12-05 03:22:48 | [diff] [blame] | 468 | const GURL& event_url, |
[email protected] | 5a38dfd | 2012-07-23 23:22:10 | [diff] [blame] | 469 | EventRouter::UserGestureState user_gesture, |
| 470 | const EventFilteringInfo& info); |
[email protected] | d9e559d | 2012-07-05 01:04:57 | [diff] [blame] | 471 | |
[email protected] | 5a38dfd | 2012-07-23 23:22:10 | [diff] [blame] | 472 | ~Event(); |
[email protected] | 6e85092 | 2012-12-05 03:22:48 | [diff] [blame] | 473 | |
Devlin Cronin | 614b014 | 2018-12-10 22:08:53 | [diff] [blame] | 474 | // Makes a deep copy of this instance. |
| 475 | std::unique_ptr<Event> DeepCopy() const; |
[email protected] | d9e559d | 2012-07-05 01:04:57 | [diff] [blame] | 476 | }; |
| 477 | |
[email protected] | 954e1349 | 2012-11-15 03:18:23 | [diff] [blame] | 478 | struct EventListenerInfo { |
David Bertoni | 3929f55 | 2019-03-28 22:10:36 | [diff] [blame] | 479 | // Constructor for a listener from a non-ServiceWorker context (background |
| 480 | // page, popup, tab, etc) |
[email protected] | 954e1349 | 2012-11-15 03:18:23 | [diff] [blame] | 481 | EventListenerInfo(const std::string& event_name, |
[email protected] | c761a96 | 2013-11-20 04:19:41 | [diff] [blame] | 482 | const std::string& extension_id, |
[email protected] | c1abb323 | 2014-07-30 18:28:39 | [diff] [blame] | 483 | const GURL& listener_url, |
[email protected] | c761a96 | 2013-11-20 04:19:41 | [diff] [blame] | 484 | content::BrowserContext* browser_context); |
David Bertoni | 3929f55 | 2019-03-28 22:10:36 | [diff] [blame] | 485 | |
| 486 | // Constructor for a listener from a ServiceWorker context. |
| 487 | EventListenerInfo(const std::string& event_name, |
| 488 | const std::string& extension_id, |
| 489 | const GURL& listener_url, |
| 490 | content::BrowserContext* browser_context, |
| 491 | int worker_thread_id, |
| 492 | int64_t service_worker_version_id); |
| 493 | |
[email protected] | c761a96 | 2013-11-20 04:19:41 | [diff] [blame] | 494 | // The event name including any sub-event, e.g. "runtime.onStartup" or |
| 495 | // "webRequest.onCompleted/123". |
[email protected] | 954e1349 | 2012-11-15 03:18:23 | [diff] [blame] | 496 | const std::string event_name; |
| 497 | const std::string extension_id; |
[email protected] | c1abb323 | 2014-07-30 18:28:39 | [diff] [blame] | 498 | const GURL listener_url; |
thestig | 7ade5b5 | 2017-05-23 23:13:36 | [diff] [blame] | 499 | content::BrowserContext* const browser_context; |
David Bertoni | 3929f55 | 2019-03-28 22:10:36 | [diff] [blame] | 500 | const int worker_thread_id; |
| 501 | const int64_t service_worker_version_id; |
[email protected] | 954e1349 | 2012-11-15 03:18:23 | [diff] [blame] | 502 | }; |
| 503 | |
[email protected] | 5a38dfd | 2012-07-23 23:22:10 | [diff] [blame] | 504 | } // namespace extensions |
[email protected] | d9e559d | 2012-07-05 01:04:57 | [diff] [blame] | 505 | |
[email protected] | 3442353 | 2013-11-21 18:13:10 | [diff] [blame] | 506 | #endif // EXTENSIONS_BROWSER_EVENT_ROUTER_H_ |