Chromium Code Reviews| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 205 if (host) | 205 if (host) |
| 206 CloseChannel(port_id, error_message); | 206 CloseChannel(port_id, error_message); |
| 207 } | 207 } |
| 208 void PendingPostMessage(int port_id, | 208 void PendingPostMessage(int port_id, |
| 209 scoped_ptr<base::ListValue> message, | 209 scoped_ptr<base::ListValue> message, |
| 210 extensions::ExtensionHost* host) { | 210 extensions::ExtensionHost* host) { |
| 211 if (host) | 211 if (host) |
| 212 PostMessage(port_id, message.Pass()); | 212 PostMessage(port_id, message.Pass()); |
| 213 } | 213 } |
| 214 | 214 |
| 215 // Immediate dispatches a disconnect to |source| for |port_id| given |reason|. | |
|
Jeffrey Yasskin
2013/06/08 00:28:09
Is "reason" a human-readable string or something e
not at google - send to devlin
2013/06/08 02:02:33
Done.
| |
| 216 void DispatchOnDisconnect(content::RenderProcessHost* source, | |
| 217 int port_id, | |
| 218 const std::string& extension_id, | |
| 219 const std::string& reason); | |
| 220 void DispatchOnDisconnect(content::RenderProcessHost* source, | |
| 221 int port_id, | |
| 222 const std::string& reason) { | |
| 223 DispatchOnDisconnect(source, port_id, std::string(), reason); | |
| 224 } | |
| 225 | |
| 215 // ProfileKeyedAPI implementation. | 226 // ProfileKeyedAPI implementation. |
| 216 static const char* service_name() { | 227 static const char* service_name() { |
| 217 return "MessageService"; | 228 return "MessageService"; |
| 218 } | 229 } |
| 219 static const bool kServiceRedirectedInIncognito = true; | 230 static const bool kServiceRedirectedInIncognito = true; |
| 220 static const bool kServiceIsCreatedWithBrowserContext = false; | 231 static const bool kServiceIsCreatedWithBrowserContext = false; |
| 221 static const bool kServiceIsNULLWhileTesting = true; | 232 static const bool kServiceIsNULLWhileTesting = true; |
| 222 | 233 |
| 223 content::NotificationRegistrar registrar_; | 234 content::NotificationRegistrar registrar_; |
| 224 MessageChannelMap channels_; | 235 MessageChannelMap channels_; |
| 225 PendingChannelMap pending_channels_; | 236 PendingChannelMap pending_channels_; |
| 226 | 237 |
| 227 // Weak pointer. Guaranteed to outlive this class. | 238 // Weak pointer. Guaranteed to outlive this class. |
| 228 LazyBackgroundTaskQueue* lazy_background_task_queue_; | 239 LazyBackgroundTaskQueue* lazy_background_task_queue_; |
| 229 | 240 |
| 230 base::WeakPtrFactory<MessageService> weak_factory_; | 241 base::WeakPtrFactory<MessageService> weak_factory_; |
| 231 | 242 |
| 232 DISALLOW_COPY_AND_ASSIGN(MessageService); | 243 DISALLOW_COPY_AND_ASSIGN(MessageService); |
| 233 }; | 244 }; |
| 234 | 245 |
| 235 } // namespace extensions | 246 } // namespace extensions |
| 236 | 247 |
| 237 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_SERVICE_H_ | 248 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_SERVICE_H_ |
| OLD | NEW |