OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef EXTENSIONS_BROWSER_SERVICE_WORKER_TASK_QUEUE_H_ |
| 6 #define EXTENSIONS_BROWSER_SERVICE_WORKER_TASK_QUEUE_H_ |
| 7 |
| 8 #include "components/keyed_service/core/keyed_service.h" |
| 9 #include "extensions/browser/lazy_context_task_queue.h" |
| 10 #include "extensions/common/extension_id.h" |
| 11 #include "url/gurl.h" |
| 12 |
| 13 namespace content { |
| 14 class BrowserContext; |
| 15 } |
| 16 |
| 17 namespace extensions { |
| 18 class Extension; |
| 19 class LazyContextId; |
| 20 |
| 21 // TODO(lazyboy): This class doesn't queue up any tasks, implement. See |
| 22 // LazyBackgroundTaskQueue. |
| 23 // TODO(lazyboy): Clean up queue when extension is unloaded/uninstalled. |
| 24 class ServiceWorkerTaskQueue : public KeyedService, |
| 25 public LazyContextTaskQueue { |
| 26 public: |
| 27 explicit ServiceWorkerTaskQueue(content::BrowserContext* browser_context); |
| 28 ~ServiceWorkerTaskQueue() override; |
| 29 |
| 30 // Convenience method to return the ServiceWorkerTaskQueue for a given |
| 31 // |context|. |
| 32 static ServiceWorkerTaskQueue* Get(content::BrowserContext* context); |
| 33 |
| 34 bool ShouldEnqueueTask(content::BrowserContext* context, |
| 35 const Extension* extension) override; |
| 36 void AddPendingTaskToDispatchEvent( |
| 37 LazyContextId* context_id, |
| 38 const LazyContextTaskQueue::PendingTask& task) override; |
| 39 |
| 40 private: |
| 41 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerTaskQueue); |
| 42 }; |
| 43 |
| 44 } // namespace extensions |
| 45 |
| 46 #endif // EXTENSIONS_BROWSER_SERVICE_WORKER_TASK_QUEUE_H_ |
OLD | NEW |