Chromium Code Reviews| Index: extensions/browser/process_manager.cc |
| diff --git a/extensions/browser/process_manager.cc b/extensions/browser/process_manager.cc |
| index 12afd7c74d2b44931878991f1ef8fd259d9a930e..157ad76c89926c5ffdebd44bccfaf4c57a6dd9d3 100644 |
| --- a/extensions/browser/process_manager.cc |
| +++ b/extensions/browser/process_manager.cc |
| @@ -230,14 +230,11 @@ ProcessManager::ProcessManager(BrowserContext* context, |
| devtools_callback_(base::Bind(&ProcessManager::OnDevToolsStateChanged, |
| base::Unretained(this))), |
| last_background_close_sequence_id_(0), |
| - weak_ptr_factory_(this) { |
| + weak_ptr_factory_(this), |
| + extension_registry_observer_(this) { |
| + extension_registry_observer_.Add(ExtensionRegistry::Get(original_context)); |
| registrar_.Add(this, chrome::NOTIFICATION_EXTENSIONS_READY, |
| content::Source<BrowserContext>(original_context)); |
| - registrar_.Add(this, |
| - chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| - content::Source<BrowserContext>(original_context)); |
| - registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| - content::Source<BrowserContext>(original_context)); |
| registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED, |
| content::Source<BrowserContext>(context)); |
| registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, |
| @@ -647,33 +644,6 @@ void ProcessManager::Observe(int type, |
| break; |
| } |
| - case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: { |
| - BrowserContext* context = content::Source<BrowserContext>(source).ptr(); |
| - ExtensionSystem* system = ExtensionSystem::Get(context); |
| - if (system->ready().is_signaled()) { |
| - // The extension system is ready, so create the background host. |
| - const Extension* extension = |
| - content::Details<const Extension>(details).ptr(); |
| - CreateBackgroundHostForExtensionLoad(this, extension); |
| - } |
| - break; |
| - } |
| - |
| - case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: { |
| - const Extension* extension = |
| - content::Details<UnloadedExtensionInfo>(details)->extension; |
| - for (ExtensionHostSet::iterator iter = background_hosts_.begin(); |
| - iter != background_hosts_.end(); ++iter) { |
| - ExtensionHost* host = *iter; |
| - if (host->extension_id() == extension->id()) { |
| - CloseBackgroundHost(host); |
| - break; |
| - } |
| - } |
| - UnregisterExtension(extension->id()); |
| - break; |
| - } |
| - |
| case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: { |
| ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); |
| if (background_hosts_.erase(host)) { |
| @@ -747,6 +717,31 @@ void ProcessManager::Observe(int type, |
| } |
| } |
| +void ProcessManager::OnExtensionLoaded(content::BrowserContext* browser_context, |
| + const Extension* extension) { |
| + ExtensionSystem* system = ExtensionSystem::Get(browser_context); |
| + if (system->ready().is_signaled()) { |
|
Devlin
2014/07/17 20:13:11
Let's go ahead and inline system here:
if (Extensi
limasdf
2014/07/20 05:24:28
Done.
|
| + // The extension system is ready, so create the background host. |
| + CreateBackgroundHostForExtensionLoad(this, extension); |
| + } |
| +} |
| + |
| +void ProcessManager::OnExtensionUnloaded( |
| + content::BrowserContext* browser_context, |
| + const Extension* extension, |
| + UnloadedExtensionInfo::Reason reason) { |
| + for (ExtensionHostSet::iterator iter = background_hosts_.begin(); |
| + iter != background_hosts_.end(); |
| + ++iter) { |
| + ExtensionHost* host = *iter; |
| + if (host->extension_id() == extension->id()) { |
| + CloseBackgroundHost(host); |
| + break; |
| + } |
| + } |
| + UnregisterExtension(extension->id()); |
| +} |
| + |
| void ProcessManager::OnDevToolsStateChanged( |
| content::DevToolsAgentHost* agent_host, |
| bool attached) { |