OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_EXTENSION_EVENT_ROUTER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_ROUTER_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_ROUTER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_ROUTER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 class ExtensionEventRouter : public NotificationObserver { | 23 class ExtensionEventRouter : public NotificationObserver { |
24 public: | 24 public: |
25 // Returns true if the given extension can see events and data from another | 25 // Returns true if the given extension can see events and data from another |
26 // sub-profile (incognito to original profile, or vice versa). | 26 // sub-profile (incognito to original profile, or vice versa). |
27 static bool CanCrossIncognito(Profile* profile, | 27 static bool CanCrossIncognito(Profile* profile, |
28 const std::string& extension_id); | 28 const std::string& extension_id); |
29 static bool CanCrossIncognito(Profile* profile, const Extension* extension); | 29 static bool CanCrossIncognito(Profile* profile, const Extension* extension); |
30 | 30 |
31 explicit ExtensionEventRouter(Profile* profile); | 31 explicit ExtensionEventRouter(Profile* profile); |
32 ~ExtensionEventRouter(); | 32 virtual ~ExtensionEventRouter(); |
33 | 33 |
34 // Add or remove the process/extension pair as a listener for |event_name|. | 34 // Add or remove the process/extension pair as a listener for |event_name|. |
35 // Note that multiple extensions can share a process due to process | 35 // Note that multiple extensions can share a process due to process |
36 // collapsing. Also, a single extension can have 2 processes if it is a split | 36 // collapsing. Also, a single extension can have 2 processes if it is a split |
37 // mode extension. | 37 // mode extension. |
38 void AddEventListener(const std::string& event_name, | 38 void AddEventListener(const std::string& event_name, |
39 RenderProcessHost* process, | 39 RenderProcessHost* process, |
40 const std::string& extension_id); | 40 const std::string& extension_id); |
41 void RemoveEventListener(const std::string& event_name, | 41 void RemoveEventListener(const std::string& event_name, |
42 RenderProcessHost* process, | 42 RenderProcessHost* process, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 | 89 |
90 // A map between an event name and a set of extensions that are listening | 90 // A map between an event name and a set of extensions that are listening |
91 // to that event. | 91 // to that event. |
92 typedef std::map<std::string, std::set<EventListener> > ListenerMap; | 92 typedef std::map<std::string, std::set<EventListener> > ListenerMap; |
93 ListenerMap listeners_; | 93 ListenerMap listeners_; |
94 | 94 |
95 DISALLOW_COPY_AND_ASSIGN(ExtensionEventRouter); | 95 DISALLOW_COPY_AND_ASSIGN(ExtensionEventRouter); |
96 }; | 96 }; |
97 | 97 |
98 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_ROUTER_H_ | 98 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_EVENT_ROUTER_H_ |
OLD | NEW |