| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 channel_name(channel_name) {} | 81 channel_name(channel_name) {} |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 namespace { | 84 namespace { |
| 85 | 85 |
| 86 static base::StaticAtomicSequenceNumber g_next_channel_id; | 86 static base::StaticAtomicSequenceNumber g_next_channel_id; |
| 87 | 87 |
| 88 static content::RenderProcessHost* GetExtensionProcess( | 88 static content::RenderProcessHost* GetExtensionProcess( |
| 89 Profile* profile, const std::string& extension_id) { | 89 Profile* profile, const std::string& extension_id) { |
| 90 SiteInstance* site_instance = | 90 SiteInstance* site_instance = |
| 91 profile->GetExtensionProcessManager()->GetSiteInstanceForURL( | 91 extensions::ExtensionSystem::Get(profile)->process_manager()-> |
| 92 Extension::GetBaseURLFromExtensionId(extension_id)); | 92 GetSiteInstanceForURL( |
| 93 Extension::GetBaseURLFromExtensionId(extension_id)); |
| 93 | 94 |
| 94 if (!site_instance->HasProcess()) | 95 if (!site_instance->HasProcess()) |
| 95 return NULL; | 96 return NULL; |
| 96 | 97 |
| 97 return site_instance->GetProcess(); | 98 return site_instance->GetProcess(); |
| 98 } | 99 } |
| 99 | 100 |
| 100 } // namespace | 101 } // namespace |
| 101 | 102 |
| 102 content::RenderProcessHost* | 103 content::RenderProcessHost* |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 500 return; | 501 return; |
| 501 | 502 |
| 502 params->source = source; | 503 params->source = source; |
| 503 params->receiver.reset(new ExtensionMessagePort(host->render_process_host(), | 504 params->receiver.reset(new ExtensionMessagePort(host->render_process_host(), |
| 504 MSG_ROUTING_CONTROL, | 505 MSG_ROUTING_CONTROL, |
| 505 params->target_extension_id)); | 506 params->target_extension_id)); |
| 506 OpenChannelImpl(params.Pass()); | 507 OpenChannelImpl(params.Pass()); |
| 507 } | 508 } |
| 508 | 509 |
| 509 } // namespace extensions | 510 } // namespace extensions |
| OLD | NEW |