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

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

Issue 2893693002: Remove NOTIFICATION_EXTENSION_ENABLED. (Closed)
Patch Set: address comments + fix theme update path for skipping already set theme 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 865438513dd39f0ea0d461506492a3c0736b8112..df01e288d3f2d3f9f3ce1b0f8fcef43bf88fae6a 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.
@@ -924,11 +927,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,
@@ -2557,3 +2556,18 @@ void ExtensionService::OnInstalledExtensionsLoaded() {
OnBlacklistUpdated();
}
+
+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)) {
+ // Wake up the event page by posting a dummy task so that we can reconnect
+ // devtools to it later in DidCreateRenderViewForBackgroundPage().
+ extensions::LazyBackgroundTaskQueue* queue =
+ extensions::LazyBackgroundTaskQueue::Get(profile_);
+ queue->AddPendingTask(profile_, extension->id(),
+ base::Bind(&DoNothingWithExtensionHost));
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698