OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_MESSAGE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 static std::string GetPerExtensionEventName(const std::string& event_name, | 64 static std::string GetPerExtensionEventName(const std::string& event_name, |
65 const std::string& extension_id); | 65 const std::string& extension_id); |
66 | 66 |
67 // Allocates a pair of port ids. | 67 // Allocates a pair of port ids. |
68 // NOTE: this can be called from any thread. | 68 // NOTE: this can be called from any thread. |
69 static void AllocatePortIdPair(int* port1, int* port2); | 69 static void AllocatePortIdPair(int* port1, int* port2); |
70 | 70 |
71 explicit ExtensionMessageService(Profile* profile); | 71 explicit ExtensionMessageService(Profile* profile); |
72 | 72 |
73 // Notification that our owning profile is going away. | 73 // Notification that our owning profile is going away. |
74 void ProfileDestroyed(); | 74 void DestroyingProfile(); |
75 | 75 |
76 // Add or remove |render_process_pid| as a listener for |event_name|. | 76 // Add or remove |render_process_pid| as a listener for |event_name|. |
77 void AddEventListener(const std::string& event_name, int render_process_id); | 77 void AddEventListener(const std::string& event_name, int render_process_id); |
78 void RemoveEventListener(const std::string& event_name, | 78 void RemoveEventListener(const std::string& event_name, |
79 int render_process_id); | 79 int render_process_id); |
80 | 80 |
81 // Returns true if there is at least one listener for the given event. | 81 // Returns true if there is at least one listener for the given event. |
82 bool HasEventListener(const std::string& event_name); | 82 bool HasEventListener(const std::string& event_name); |
83 | 83 |
84 // Send an event to every registered extension renderer. If | 84 // Send an event to every registered extension renderer. If |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 | 181 |
182 // A map between an event name and a set of process id's that are listening | 182 // A map between an event name and a set of process id's that are listening |
183 // to that event. | 183 // to that event. |
184 typedef std::map<std::string, std::set<int> > ListenerMap; | 184 typedef std::map<std::string, std::set<int> > ListenerMap; |
185 ListenerMap listeners_; | 185 ListenerMap listeners_; |
186 | 186 |
187 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageService); | 187 DISALLOW_COPY_AND_ASSIGN(ExtensionMessageService); |
188 }; | 188 }; |
189 | 189 |
190 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ | 190 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_SERVICE_H_ |
OLD | NEW |