OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/extension_process_manager.h" | 5 #include "chrome/browser/extensions/extension_process_manager.h" |
6 | 6 |
7 #include "chrome/browser/browsing_instance.h" | 7 #include "chrome/browser/browsing_instance.h" |
8 #include "chrome/browser/extensions/extension_host.h" | 8 #include "chrome/browser/extensions/extension_host.h" |
9 #include "chrome/browser/extensions/extensions_service.h" | 9 #include "chrome/browser/extensions/extensions_service.h" |
10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 // Extension ids should get removed from the map before the process ids get | 123 // Extension ids should get removed from the map before the process ids get |
124 // reused from a dead renderer. | 124 // reused from a dead renderer. |
125 DCHECK(it == process_ids_.end()); | 125 DCHECK(it == process_ids_.end()); |
126 process_ids_[extension_id] = process_id; | 126 process_ids_[extension_id] = process_id; |
127 | 127 |
128 ExtensionsService* extension_service = | 128 ExtensionsService* extension_service = |
129 browsing_instance_->profile()->GetExtensionsService(); | 129 browsing_instance_->profile()->GetExtensionsService(); |
130 | 130 |
131 std::vector<std::string> page_action_ids; | 131 std::vector<std::string> page_action_ids; |
132 Extension* extension = extension_service->GetExtensionById(extension_id); | 132 Extension* extension = extension_service->GetExtensionById(extension_id); |
133 for (ExtensionActionMap::const_iterator i = | 133 if (extension->page_action()) |
134 extension->page_actions().begin(); | 134 page_action_ids.push_back(extension->page_action()->id()); |
135 i != extension->page_actions().end(); ++i) { | |
136 page_action_ids.push_back(i->first); | |
137 } | |
138 | 135 |
139 RenderProcessHost* rph = RenderProcessHost::FromID(process_id); | 136 RenderProcessHost* rph = RenderProcessHost::FromID(process_id); |
140 rph->Send(new ViewMsg_Extension_UpdatePageActions(extension_id, | 137 rph->Send(new ViewMsg_Extension_UpdatePageActions(extension_id, |
141 page_action_ids)); | 138 page_action_ids)); |
142 | 139 |
143 // Send l10n messages to the renderer - if there are any. | 140 // Send l10n messages to the renderer - if there are any. |
144 if (extension->message_bundle()) { | 141 if (extension->message_bundle()) { |
145 rph->Send(new ViewMsg_Extension_SetL10nMessages( | 142 rph->Send(new ViewMsg_Extension_SetL10nMessages( |
146 extension_id, *extension->message_bundle()->dictionary())); | 143 extension_id, *extension->message_bundle()->dictionary())); |
147 } | 144 } |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 void ExtensionProcessManager::OnExtensionHostCreated(ExtensionHost* host, | 224 void ExtensionProcessManager::OnExtensionHostCreated(ExtensionHost* host, |
228 bool is_background) { | 225 bool is_background) { |
229 all_hosts_.insert(host); | 226 all_hosts_.insert(host); |
230 if (is_background) | 227 if (is_background) |
231 background_hosts_.insert(host); | 228 background_hosts_.insert(host); |
232 NotificationService::current()->Notify( | 229 NotificationService::current()->Notify( |
233 NotificationType::EXTENSION_HOST_CREATED, | 230 NotificationType::EXTENSION_HOST_CREATED, |
234 Source<ExtensionProcessManager>(this), | 231 Source<ExtensionProcessManager>(this), |
235 Details<ExtensionHost>(host)); | 232 Details<ExtensionHost>(host)); |
236 } | 233 } |
OLD | NEW |