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

Unified Diff: extensions/browser/lazy_context_id.h

Issue 2940883007: Move lazy event dispatching code out of EventRouter. (Closed)
Patch Set: address comments 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/events/lazy_event_dispatcher.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
new file mode 100644
index 0000000000000000000000000000000000000000..aef418dbcf0f5cb319fac5d4a534bf20028eccfc
--- /dev/null
+++ b/extensions/browser/lazy_context_id.h
@@ -0,0 +1,51 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef EXTENSIONS_BROWSER_LAZY_CONTEXT_ID_H_
+#define EXTENSIONS_BROWSER_LAZY_CONTEXT_ID_H_
+
+#include "extensions/common/extension_id.h"
+#include "url/gurl.h"
+
+namespace content {
+class BrowserContext;
+}
+
+namespace extensions {
+class LazyBackgroundTaskQueue;
+
+class LazyContextId {
+ public:
+ enum class Type {
+ kEventPage,
+ };
+
+ // An event page (lazy background) context.
+ LazyContextId(content::BrowserContext* context,
+ const ExtensionId& extension_id);
+ // TODO(lazyboy): Service worker context.
+
+ bool is_for_event_page() const { return type_ == Type::kEventPage; }
+
+ content::BrowserContext* browser_context() const { return context_; }
+ void set_browser_context(content::BrowserContext* context) {
+ context_ = context;
+ }
+
+ const ExtensionId& extension_id() const { return extension_id_; }
+
+ // TODO(lazyboy): Use a generic interface to support service workers.
+ LazyBackgroundTaskQueue* GetTaskQueue();
+
+ private:
+ const Type type_;
+ content::BrowserContext* context_;
+ const ExtensionId extension_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(LazyContextId);
+};
+
+} // namespace extensions
+
+#endif // EXTENSIONS_BROWSER_LAZY_CONTEXT_ID_H_
« no previous file with comments | « extensions/browser/events/lazy_event_dispatcher.cc ('k') | extensions/browser/lazy_context_id.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698