| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 85 // |has_incognito_data| is true, the event is only sent to extension with the | 85 // |has_incognito_data| is true, the event is only sent to extension with the |
| 86 // permission to access incognito data. If |event_url| is not empty, the | 86 // permission to access incognito data. If |event_url| is not empty, the |
| 87 // event is only sent to extension with host permissions for this url. | 87 // event is only sent to extension with host permissions for this url. |
| 88 virtual void DispatchEventToRenderers( | 88 virtual void DispatchEventToRenderers( |
| 89 const std::string& event_name, const std::string& event_args, | 89 const std::string& event_name, const std::string& event_args, |
| 90 bool has_incognito_data, const GURL& event_url); | 90 Profile* source_profile, const GURL& event_url); |
| 91 | 91 |
| 92 // Same as above, except use the extension-specific naming scheme for the | 92 // Same as above, except use the extension-specific naming scheme for the |
| 93 // event. This is used by events that are per-extension. | 93 // event. This is used by events that are per-extension. |
| 94 void DispatchEventToExtension( | 94 void DispatchEventToExtension( |
| 95 const std::string& extension_id, | 95 const std::string& extension_id, |
| 96 const std::string& event_name, const std::string& event_args, | 96 const std::string& event_name, const std::string& event_args, |
| 97 bool has_incognito_data, const GURL& event_url); | 97 Profile* source_profile, const GURL& event_url); |
| 98 | 98 |
| 99 // Given an extension's ID, opens a channel between the given renderer "port" | 99 // Given an extension's ID, opens a channel between the given renderer "port" |
| 100 // and every listening context owned by that extension. |channel_name| is | 100 // and every listening context owned by that extension. |channel_name| is |
| 101 // an optional identifier for use by extension developers. | 101 // an optional identifier for use by extension developers. |
| 102 void OpenChannelToExtension( | 102 void OpenChannelToExtension( |
| 103 int source_process_id, int source_routing_id, int receiver_port_id, | 103 int source_process_id, int source_routing_id, int receiver_port_id, |
| 104 const std::string& source_extension_id, | 104 const std::string& source_extension_id, |
| 105 const std::string& target_extension_id, | 105 const std::string& target_extension_id, |
| 106 const std::string& channel_name); | 106 const std::string& channel_name); |
| 107 | 107 |
| (...skipping 73 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 |