| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef EXTENSIONS_BROWSER_LAZY_BACKGROUND_TASK_QUEUE_H_ | 5 #ifndef EXTENSIONS_BROWSER_LAZY_BACKGROUND_TASK_QUEUE_H_ |
| 6 #define EXTENSIONS_BROWSER_LAZY_BACKGROUND_TASK_QUEUE_H_ | 6 #define EXTENSIONS_BROWSER_LAZY_BACKGROUND_TASK_QUEUE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 // pending the load of its background page. | 67 // pending the load of its background page. |
| 68 typedef std::string ExtensionID; | 68 typedef std::string ExtensionID; |
| 69 typedef std::pair<content::BrowserContext*, ExtensionID> PendingTasksKey; | 69 typedef std::pair<content::BrowserContext*, ExtensionID> PendingTasksKey; |
| 70 typedef std::vector<PendingTask> PendingTasksList; | 70 typedef std::vector<PendingTask> PendingTasksList; |
| 71 typedef std::map<PendingTasksKey, | 71 typedef std::map<PendingTasksKey, |
| 72 linked_ptr<PendingTasksList> > PendingTasksMap; | 72 linked_ptr<PendingTasksList> > PendingTasksMap; |
| 73 | 73 |
| 74 // content::NotificationObserver interface. | 74 // content::NotificationObserver interface. |
| 75 virtual void Observe(int type, | 75 virtual void Observe(int type, |
| 76 const content::NotificationSource& source, | 76 const content::NotificationSource& source, |
| 77 const content::NotificationDetails& details) OVERRIDE; | 77 const content::NotificationDetails& details) override; |
| 78 | 78 |
| 79 // ExtensionRegistryObserver interface. | 79 // ExtensionRegistryObserver interface. |
| 80 virtual void OnExtensionUnloaded( | 80 virtual void OnExtensionUnloaded( |
| 81 content::BrowserContext* browser_context, | 81 content::BrowserContext* browser_context, |
| 82 const Extension* extension, | 82 const Extension* extension, |
| 83 UnloadedExtensionInfo::Reason reason) OVERRIDE; | 83 UnloadedExtensionInfo::Reason reason) override; |
| 84 | 84 |
| 85 // Called when a lazy background page has finished loading, or has failed to | 85 // Called when a lazy background page has finished loading, or has failed to |
| 86 // load (host is NULL in that case). All enqueued tasks are run in order. | 86 // load (host is NULL in that case). All enqueued tasks are run in order. |
| 87 void ProcessPendingTasks( | 87 void ProcessPendingTasks( |
| 88 ExtensionHost* host, | 88 ExtensionHost* host, |
| 89 content::BrowserContext* context, | 89 content::BrowserContext* context, |
| 90 const Extension* extension); | 90 const Extension* extension); |
| 91 | 91 |
| 92 content::BrowserContext* browser_context_; | 92 content::BrowserContext* browser_context_; |
| 93 content::NotificationRegistrar registrar_; | 93 content::NotificationRegistrar registrar_; |
| 94 PendingTasksMap pending_tasks_; | 94 PendingTasksMap pending_tasks_; |
| 95 | 95 |
| 96 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 96 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
| 97 extension_registry_observer_; | 97 extension_registry_observer_; |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 } // namespace extensions | 100 } // namespace extensions |
| 101 | 101 |
| 102 #endif // EXTENSIONS_BROWSER_LAZY_BACKGROUND_TASK_QUEUE_H_ | 102 #endif // EXTENSIONS_BROWSER_LAZY_BACKGROUND_TASK_QUEUE_H_ |
| OLD | NEW |