| 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 #include "chrome/browser/extensions/api/messaging/message_service.h" | 5 #include "chrome/browser/extensions/api/messaging/message_service.h" |
| 6 | 6 |
| 7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 static base::LazyInstance<ProfileKeyedAPIFactory<MessageService> > | 181 static base::LazyInstance<ProfileKeyedAPIFactory<MessageService> > |
| 182 g_factory = LAZY_INSTANCE_INITIALIZER; | 182 g_factory = LAZY_INSTANCE_INITIALIZER; |
| 183 | 183 |
| 184 // static | 184 // static |
| 185 ProfileKeyedAPIFactory<MessageService>* MessageService::GetFactoryInstance() { | 185 ProfileKeyedAPIFactory<MessageService>* MessageService::GetFactoryInstance() { |
| 186 return &g_factory.Get(); | 186 return &g_factory.Get(); |
| 187 } | 187 } |
| 188 | 188 |
| 189 // static | 189 // static |
| 190 MessageService* MessageService::Get(Profile* profile) { | 190 MessageService* MessageService::Get(content::BrowserContext* context) { |
| 191 Profile* profile = Profile::FromBrowserContext(context); |
| 191 return ProfileKeyedAPIFactory<MessageService>::GetForProfile(profile); | 192 return ProfileKeyedAPIFactory<MessageService>::GetForProfile(profile); |
| 192 } | 193 } |
| 193 | 194 |
| 194 void MessageService::OpenChannelToExtension( | 195 void MessageService::OpenChannelToExtension( |
| 195 int source_process_id, int source_routing_id, int receiver_port_id, | 196 int source_process_id, int source_routing_id, int receiver_port_id, |
| 196 const std::string& source_extension_id, | 197 const std::string& source_extension_id, |
| 197 const std::string& target_extension_id, | 198 const std::string& target_extension_id, |
| 198 const GURL& source_url, | 199 const GURL& source_url, |
| 199 const std::string& channel_name, | 200 const std::string& channel_name, |
| 200 bool include_tls_channel_id) { | 201 bool include_tls_channel_id) { |
| (...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 753 } | 754 } |
| 754 | 755 |
| 755 void MessageService::DispatchOnDisconnect(content::RenderProcessHost* source, | 756 void MessageService::DispatchOnDisconnect(content::RenderProcessHost* source, |
| 756 int port_id, | 757 int port_id, |
| 757 const std::string& error_message) { | 758 const std::string& error_message) { |
| 758 ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, ""); | 759 ExtensionMessagePort port(source, MSG_ROUTING_CONTROL, ""); |
| 759 port.DispatchOnDisconnect(GET_OPPOSITE_PORT_ID(port_id), error_message); | 760 port.DispatchOnDisconnect(GET_OPPOSITE_PORT_ID(port_id), error_message); |
| 760 } | 761 } |
| 761 | 762 |
| 762 } // namespace extensions | 763 } // namespace extensions |
| OLD | NEW |