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

Unified Diff: extensions/browser/lazy_background_task_queue.cc

Issue 391563002: Remove extension unload notification from LazyBackgroundLazyBackgroundTaskQueue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 6 years, 5 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
« no previous file with comments | « extensions/browser/lazy_background_task_queue.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/lazy_background_task_queue.cc
diff --git a/extensions/browser/lazy_background_task_queue.cc b/extensions/browser/lazy_background_task_queue.cc
index 9edad4f65acc7548da8d0437adcc4486595ac8c3..4b8ee09e915c3c57f1f94e672405945b68e91f15 100644
--- a/extensions/browser/lazy_background_task_queue.cc
+++ b/extensions/browser/lazy_background_task_queue.cc
@@ -27,13 +27,13 @@ namespace extensions {
LazyBackgroundTaskQueue::LazyBackgroundTaskQueue(
content::BrowserContext* browser_context)
- : browser_context_(browser_context) {
+ : browser_context_(browser_context), extension_registry_observer_(this) {
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING,
content::NotificationService::AllBrowserContextsAndSources());
registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED,
content::NotificationService::AllBrowserContextsAndSources());
- registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
- content::Source<content::BrowserContext>(browser_context));
+
+ extension_registry_observer_.Add(ExtensionRegistry::Get(browser_context));
}
LazyBackgroundTaskQueue::~LazyBackgroundTaskQueue() {
@@ -162,28 +162,26 @@ void LazyBackgroundTaskQueue::Observe(
}
break;
}
- case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: {
- // Notify consumers that the page failed to load.
- content::BrowserContext* browser_context =
- content::Source<content::BrowserContext>(source).ptr();
- UnloadedExtensionInfo* unloaded =
- content::Details<UnloadedExtensionInfo>(details).ptr();
- ProcessPendingTasks(NULL, browser_context, unloaded->extension);
- // If this extension is also running in an off-the-record context,
- // notify that task queue as well.
- ExtensionsBrowserClient* browser_client = ExtensionsBrowserClient::Get();
- if (browser_client->HasOffTheRecordContext(browser_context)) {
- ProcessPendingTasks(
- NULL,
- browser_client->GetOffTheRecordContext(browser_context),
- unloaded->extension);
- }
- break;
- }
default:
NOTREACHED();
break;
}
}
+void LazyBackgroundTaskQueue::OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) {
+ // Notify consumers that the page failed to load.
+ ProcessPendingTasks(NULL, browser_context, extension);
+ // If this extension is also running in an off-the-record context, notify that
+ // task queue as well.
+ ExtensionsBrowserClient* browser_client = ExtensionsBrowserClient::Get();
+ if (browser_client->HasOffTheRecordContext(browser_context)) {
+ ProcessPendingTasks(NULL,
+ browser_client->GetOffTheRecordContext(browser_context),
+ extension);
+ }
+}
+
} // namespace extensions
« no previous file with comments | « extensions/browser/lazy_background_task_queue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698