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

Unified Diff: extensions/browser/lazy_context_id.h

Issue 2943583002: [extension SW] Support lazy events from extension service workers. (Closed)
Patch Set: sync @tott Created 3 years, 6 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 | « extensions/browser/lazy_background_task_queue.cc ('k') | extensions/browser/lazy_context_id.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/lazy_context_id.h
diff --git a/extensions/browser/lazy_context_id.h b/extensions/browser/lazy_context_id.h
index aef418dbcf0f5cb319fac5d4a534bf20028eccfc..13a906145c74894ac44261a527cea412d453acfb 100644
--- a/extensions/browser/lazy_context_id.h
+++ b/extensions/browser/lazy_context_id.h
@@ -13,20 +13,26 @@ class BrowserContext;
}
namespace extensions {
-class LazyBackgroundTaskQueue;
+class LazyContextTaskQueue;
class LazyContextId {
public:
enum class Type {
kEventPage,
+ kServiceWorker,
};
// An event page (lazy background) context.
LazyContextId(content::BrowserContext* context,
const ExtensionId& extension_id);
- // TODO(lazyboy): Service worker context.
+
+ // An extension service worker context.
+ LazyContextId(content::BrowserContext* context,
+ const ExtensionId& extension_id,
+ const GURL& service_worker_scope);
bool is_for_event_page() const { return type_ == Type::kEventPage; }
+ bool is_for_service_worker() const { return type_ == Type::kServiceWorker; }
content::BrowserContext* browser_context() const { return context_; }
void set_browser_context(content::BrowserContext* context) {
@@ -35,13 +41,18 @@ class LazyContextId {
const ExtensionId& extension_id() const { return extension_id_; }
- // TODO(lazyboy): Use a generic interface to support service workers.
- LazyBackgroundTaskQueue* GetTaskQueue();
+ const GURL& service_worker_scope() const {
+ DCHECK(is_for_service_worker());
+ return service_worker_scope_;
+ }
+
+ LazyContextTaskQueue* GetTaskQueue();
private:
const Type type_;
content::BrowserContext* context_;
const ExtensionId extension_id_;
+ const GURL service_worker_scope_;
DISALLOW_COPY_AND_ASSIGN(LazyContextId);
};
« no previous file with comments | « extensions/browser/lazy_background_task_queue.cc ('k') | extensions/browser/lazy_context_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698