OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_TASK_QUEUE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_TASK_QUEUE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_TASK_QUEUE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_TASK_QUEUE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
14 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
15 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
19 | 19 |
20 class Extension; | |
21 class ExtensionHost; | 20 class ExtensionHost; |
22 class Profile; | 21 class Profile; |
23 | 22 |
24 namespace extensions { | 23 namespace extensions { |
25 | 24 |
| 25 class Extension; |
| 26 |
26 // This class maintains a queue of tasks that should execute when an | 27 // This class maintains a queue of tasks that should execute when an |
27 // extension's lazy background page is loaded. It is also in charge of loading | 28 // extension's lazy background page is loaded. It is also in charge of loading |
28 // the page when the first task is queued. | 29 // the page when the first task is queued. |
29 // | 30 // |
30 // It is the consumer's responsibility to use this class when appropriate, i.e. | 31 // It is the consumer's responsibility to use this class when appropriate, i.e. |
31 // only with extensions that have not-yet-loaded lazy background pages. | 32 // only with extensions that have not-yet-loaded lazy background pages. |
32 class LazyBackgroundTaskQueue | 33 class LazyBackgroundTaskQueue |
33 : public content::NotificationObserver, | 34 : public content::NotificationObserver, |
34 public base::SupportsWeakPtr<LazyBackgroundTaskQueue> { | 35 public base::SupportsWeakPtr<LazyBackgroundTaskQueue> { |
35 public: | 36 public: |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 80 |
80 Profile* profile_; | 81 Profile* profile_; |
81 content::NotificationRegistrar registrar_; | 82 content::NotificationRegistrar registrar_; |
82 PendingTasksMap pending_tasks_; | 83 PendingTasksMap pending_tasks_; |
83 PendingPageLoadList pending_page_loads_; | 84 PendingPageLoadList pending_page_loads_; |
84 }; | 85 }; |
85 | 86 |
86 } // namespace extensions | 87 } // namespace extensions |
87 | 88 |
88 #endif // CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_TASK_QUEUE_H_ | 89 #endif // CHROME_BROWSER_EXTENSIONS_LAZY_BACKGROUND_TASK_QUEUE_H_ |
OLD | NEW |