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

Unified Diff: extensions/browser/lazy_background_task_queue.h

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 | « no previous file | extensions/browser/lazy_background_task_queue.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/lazy_background_task_queue.h
diff --git a/extensions/browser/lazy_background_task_queue.h b/extensions/browser/lazy_background_task_queue.h
index a92ec7c38334b1325306a5116440f2adb6431bc6..0333757ef0d83a347db4252956612d4fb27eaf98 100644
--- a/extensions/browser/lazy_background_task_queue.h
+++ b/extensions/browser/lazy_background_task_queue.h
@@ -12,8 +12,10 @@
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/memory/linked_ptr.h"
+#include "base/scoped_observer.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
+#include "extensions/browser/extension_registry_observer.h"
namespace content {
class BrowserContext;
@@ -22,6 +24,7 @@ class BrowserContext;
namespace extensions {
class Extension;
class ExtensionHost;
+class ExtensionRegistry;
// This class maintains a queue of tasks that should execute when an
// extension's lazy background page is loaded. It is also in charge of loading
@@ -29,7 +32,8 @@ class ExtensionHost;
//
// It is the consumer's responsibility to use this class when appropriate, i.e.
// only with extensions that have not-yet-loaded lazy background pages.
-class LazyBackgroundTaskQueue : public content::NotificationObserver {
+class LazyBackgroundTaskQueue : public content::NotificationObserver,
+ public ExtensionRegistryObserver {
public:
typedef base::Callback<void(ExtensionHost*)> PendingTask;
@@ -72,6 +76,12 @@ class LazyBackgroundTaskQueue : public content::NotificationObserver {
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
+ // ExtensionRegistryObserver interface.
+ virtual void OnExtensionUnloaded(
+ content::BrowserContext* browser_context,
+ const Extension* extension,
+ UnloadedExtensionInfo::Reason reason) OVERRIDE;
+
// Called when a lazy background page has finished loading, or has failed to
// load (host is NULL in that case). All enqueued tasks are run in order.
void ProcessPendingTasks(
@@ -82,6 +92,9 @@ class LazyBackgroundTaskQueue : public content::NotificationObserver {
content::BrowserContext* browser_context_;
content::NotificationRegistrar registrar_;
PendingTasksMap pending_tasks_;
+
+ ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
+ extension_registry_observer_;
};
} // namespace extensions
« no previous file with comments | « no previous file | extensions/browser/lazy_background_task_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698