Chromium Code Reviews| Index: chrome/browser/extensions/extension_service.cc |
| diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc |
| index 33d5dfbf24396ed174431705bc2be7371d49d8dc..393b76865f4cd4cc3fe8f865ba36cec68dc1a073 100644 |
| --- a/chrome/browser/extensions/extension_service.cc |
| +++ b/chrome/browser/extensions/extension_service.cc |
| @@ -79,6 +79,7 @@ |
| #include "extensions/browser/extensions_browser_client.h" |
| #include "extensions/browser/external_install_info.h" |
| #include "extensions/browser/install_flag.h" |
| +#include "extensions/browser/lazy_background_task_queue.h" |
| #include "extensions/browser/renderer_startup_helper.h" |
| #include "extensions/browser/runtime_data.h" |
| #include "extensions/browser/uninstall_reason.h" |
| @@ -144,6 +145,8 @@ const int kUpdateIdleDelay = 5; |
| // TODO(samuong): Remove this in M58 (see comment in ExtensionService::Init). |
| const char kDeprecatedLoadComponentExtension[] = "load-component-extension"; |
| +void DoNothingWithExtensionHost(extensions::ExtensionHost* host) {} |
| + |
| } // namespace |
| // ExtensionService. |
| @@ -929,11 +932,7 @@ void ExtensionService::EnableExtension(const std::string& extension_id) { |
| NotifyExtensionLoaded(extension); |
| - // Notify listeners that the extension was enabled. |
| - content::NotificationService::current()->Notify( |
| - extensions::NOTIFICATION_EXTENSION_ENABLED, |
| - content::Source<Profile>(profile_), |
| - content::Details<const Extension>(extension)); |
| + MaybeReconnectDevtoolsToLazyBackgroundPage(extension); |
| } |
| void ExtensionService::DisableExtension(const std::string& extension_id, |
| @@ -2561,3 +2560,16 @@ void ExtensionService::OnProfileDestructionStarted() { |
| UnloadExtension(*it, UnloadedExtensionReason::PROFILE_SHUTDOWN); |
| } |
| } |
| + |
| +void ExtensionService::MaybeReconnectDevtoolsToLazyBackgroundPage( |
| + const Extension* extension) { |
| + OrphanedDevTools::iterator iter = orphaned_dev_tools_.find(extension->id()); |
| + if (iter == orphaned_dev_tools_.end()) |
| + return; |
| + if (extensions::BackgroundInfo::HasLazyBackgroundPage(extension)) { |
|
Devlin
2017/05/23 21:30:36
Add a comment explaining this.
lazyboy
2017/05/23 23:19:08
Done.
|
| + extensions::LazyBackgroundTaskQueue* queue = |
| + extensions::LazyBackgroundTaskQueue::Get(profile_); |
| + queue->AddPendingTask(profile_, extension->id(), |
| + base::Bind(&DoNothingWithExtensionHost)); |
| + } |
| +} |