OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EVENT_ROUTER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EVENT_ROUTER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // Note that multiple extensions can share a process due to process | 61 // Note that multiple extensions can share a process due to process |
62 // collapsing. Also, a single extension can have 2 processes if it is a split | 62 // collapsing. Also, a single extension can have 2 processes if it is a split |
63 // mode extension. | 63 // mode extension. |
64 void AddEventListener(const std::string& event_name, | 64 void AddEventListener(const std::string& event_name, |
65 content::RenderProcessHost* process, | 65 content::RenderProcessHost* process, |
66 const std::string& extension_id); | 66 const std::string& extension_id); |
67 void RemoveEventListener(const std::string& event_name, | 67 void RemoveEventListener(const std::string& event_name, |
68 content::RenderProcessHost* process, | 68 content::RenderProcessHost* process, |
69 const std::string& extension_id); | 69 const std::string& extension_id); |
70 | 70 |
| 71 EventListenerMap& listeners() { return listeners_; } |
| 72 |
71 // Add or remove the extension as having a lazy background page that listens | 73 // Add or remove the extension as having a lazy background page that listens |
72 // to the event. The difference from the above methods is that these will be | 74 // to the event. The difference from the above methods is that these will be |
73 // remembered even after the process goes away. We use this list to decide | 75 // remembered even after the process goes away. We use this list to decide |
74 // which extension pages to load when dispatching an event. | 76 // which extension pages to load when dispatching an event. |
75 void AddLazyEventListener(const std::string& event_name, | 77 void AddLazyEventListener(const std::string& event_name, |
76 const std::string& extension_id); | 78 const std::string& extension_id); |
77 void RemoveLazyEventListener(const std::string& event_name, | 79 void RemoveLazyEventListener(const std::string& event_name, |
78 const std::string& extension_id); | 80 const std::string& extension_id); |
79 | 81 |
80 // If |add_lazy_listener| is true also add the lazy version of this listener. | 82 // If |add_lazy_listener| is true also add the lazy version of this listener. |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 Profile* restrict_to_profile, | 267 Profile* restrict_to_profile, |
266 EventRouter::UserGestureState user_gesture, | 268 EventRouter::UserGestureState user_gesture, |
267 const EventFilteringInfo& info); | 269 const EventFilteringInfo& info); |
268 | 270 |
269 ~Event(); | 271 ~Event(); |
270 }; | 272 }; |
271 | 273 |
272 } // namespace extensions | 274 } // namespace extensions |
273 | 275 |
274 #endif // CHROME_BROWSER_EXTENSIONS_EVENT_ROUTER_H_ | 276 #endif // CHROME_BROWSER_EXTENSIONS_EVENT_ROUTER_H_ |
OLD | NEW |