| 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_API_MESSAGING_MESSAGE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_SERVICE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 typedef std::map<int, PendingMessagesQueue> PendingChannelMap; | 179 typedef std::map<int, PendingMessagesQueue> PendingChannelMap; |
| 180 | 180 |
| 181 // A map of channel ID to information about the extension that is waiting | 181 // A map of channel ID to information about the extension that is waiting |
| 182 // for that channel to open. Used for lazy background pages. | 182 // for that channel to open. Used for lazy background pages. |
| 183 typedef std::string ExtensionID; | 183 typedef std::string ExtensionID; |
| 184 typedef std::pair<content::BrowserContext*, ExtensionID> | 184 typedef std::pair<content::BrowserContext*, ExtensionID> |
| 185 PendingLazyBackgroundPageChannel; | 185 PendingLazyBackgroundPageChannel; |
| 186 typedef std::map<int, PendingLazyBackgroundPageChannel> | 186 typedef std::map<int, PendingLazyBackgroundPageChannel> |
| 187 PendingLazyBackgroundPageChannelMap; | 187 PendingLazyBackgroundPageChannelMap; |
| 188 | 188 |
| 189 // Common among OpenChannel* variants. | 189 // Common implementation for opening a channel configured by |params|. |
| 190 void OpenChannelImpl(scoped_ptr<OpenChannelParams> params); | 190 // |did_enqueue| will be true if the channel opening was delayed while |
| 191 // waiting for an event page to start, false otherwise. |
| 192 void OpenChannelImpl(content::BrowserContext* browser_context, |
| 193 scoped_ptr<OpenChannelParams> params, |
| 194 bool did_enqueue); |
| 191 | 195 |
| 192 void CloseChannelImpl(MessageChannelMap::iterator channel_iter, | 196 void CloseChannelImpl(MessageChannelMap::iterator channel_iter, |
| 193 int port_id, | 197 int port_id, |
| 194 const std::string& error_message, | 198 const std::string& error_message, |
| 195 bool notify_other_port); | 199 bool notify_other_port); |
| 196 | 200 |
| 197 // Have MessageService take ownership of |channel|, and remove any pending | 201 // Have MessageService take ownership of |channel|, and remove any pending |
| 198 // channels with the same id. | 202 // channels with the same id. |
| 199 void AddChannel(MessageChannel* channel, int receiver_port_id); | 203 void AddChannel(MessageChannel* channel, int receiver_port_id); |
| 200 | 204 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 LazyBackgroundTaskQueue* lazy_background_task_queue_; | 293 LazyBackgroundTaskQueue* lazy_background_task_queue_; |
| 290 | 294 |
| 291 base::WeakPtrFactory<MessageService> weak_factory_; | 295 base::WeakPtrFactory<MessageService> weak_factory_; |
| 292 | 296 |
| 293 DISALLOW_COPY_AND_ASSIGN(MessageService); | 297 DISALLOW_COPY_AND_ASSIGN(MessageService); |
| 294 }; | 298 }; |
| 295 | 299 |
| 296 } // namespace extensions | 300 } // namespace extensions |
| 297 | 301 |
| 298 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_SERVICE_H_ | 302 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_SERVICE_H_ |
| OLD | NEW |