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

Unified Diff: extensions/browser/event_router.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/BUILD.gn ('k') | extensions/browser/event_router.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/event_router.h
diff --git a/extensions/browser/event_router.h b/extensions/browser/event_router.h
index 8cc397ced1fe22895e19d5a55c15e0f6152eca27..25933c08bfe35a887dbe21b93fc77b7276730cca 100644
--- a/extensions/browser/event_router.h
+++ b/extensions/browser/event_router.h
@@ -15,6 +15,7 @@
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "base/scoped_observer.h"
#include "base/values.h"
#include "components/keyed_service/core/keyed_service.h"
@@ -102,6 +103,12 @@ class EventRouter : public KeyedService,
UserGestureState user_gesture,
const EventFilteringInfo& info);
+ // Returns false when the event is scoped to a context and the listening
+ // extension does not have access to events from that context.
+ static bool CanDispatchEventToBrowserContext(content::BrowserContext* context,
+ const Extension* extension,
+ const Event& event);
+
// An EventRouter is shared between |browser_context| and its associated
// incognito context. |extension_prefs| may be NULL in tests.
EventRouter(content::BrowserContext* browser_context,
@@ -299,14 +306,6 @@ class EventRouter : public KeyedService,
const base::DictionaryValue* listener_filter,
bool did_enqueue);
- // Returns false when the event is scoped to a context and the listening
- // extension does not have access to events from that context. Also fills
- // |event_args| with the proper arguments to send, which may differ if
- // the event crosses the incognito boundary.
- bool CanDispatchEventToBrowserContext(content::BrowserContext* context,
- const Extension* extension,
- const linked_ptr<Event>& event);
-
// Possibly loads given extension's background page in preparation to
// dispatch an event. Returns true if the event was queued for subsequent
// dispatch, false otherwise.
@@ -378,6 +377,8 @@ class EventRouter : public KeyedService,
LazyEventDispatchUtil lazy_event_dispatch_util_;
+ base::WeakPtrFactory<EventRouter> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(EventRouter);
};
« no previous file with comments | « extensions/browser/BUILD.gn ('k') | extensions/browser/event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698