Chromium Code Reviews| 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..55d28ee203fa499fb32eb245a39226dfdc82c5bf 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; |
| @@ -21,6 +23,7 @@ class BrowserContext; |
| namespace extensions { |
| class Extension; |
| +class ExtensionObserver; |
|
Devlin
2014/07/15 17:27:34
What is an ExtensionObserver? ;) (I think this is
limasdf
2014/07/16 05:44:58
Done.
Damn! My bad T_T.(Thank you!)
|
| class ExtensionHost; |
| // This class maintains a queue of tasks that should execute when an |
| @@ -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 |