Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1082)

Unified Diff: chrome/browser/extensions/extension_service.cc

Issue 2893693002: Remove NOTIFICATION_EXTENSION_ENABLED. (Closed)
Patch Set: connect devtools Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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));
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698