#include "extensions/browser/event_listener_map.h"
#include <stddef.h>
#include <utility>
#include "base/containers/contains.h"
#include "base/memory/ptr_util.h"
#include "content/public/browser/render_process_host.h"
#include "extensions/browser/event_router.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension_id.h"
#include "ipc/ipc_message.h"
#include "url/gurl.h"
#include "url/origin.h"
namespace extensions {
MatcherID;
std::unique_ptr<EventListener> EventListener::ForExtension(
const std::string& event_name,
const ExtensionId& extension_id,
content::RenderProcessHost* process,
std::optional<base::Value::Dict> filter) { … }
std::unique_ptr<EventListener> EventListener::ForURL(
const std::string& event_name,
const GURL& listener_url,
content::RenderProcessHost* process,
std::optional<base::Value::Dict> filter) { … }
std::unique_ptr<EventListener> EventListener::ForExtensionServiceWorker(
const std::string& event_name,
const ExtensionId& extension_id,
content::RenderProcessHost* process,
content::BrowserContext* browser_context,
const GURL& service_worker_scope,
int64_t service_worker_version_id,
int worker_thread_id,
std::optional<base::Value::Dict> filter) { … }
std::unique_ptr<EventListener> EventListener::CreateLazyListener(
const std::string& event_name,
const ExtensionId& extension_id,
content::BrowserContext* browser_context,
bool is_for_service_worker,
const GURL& service_worker_scope,
std::optional<base::Value::Dict> filter) { … }
EventListener::~EventListener() = default;
bool EventListener::Equals(const EventListener* other) const { … }
std::unique_ptr<EventListener> EventListener::Copy() const { … }
bool EventListener::IsLazy() const { … }
void EventListener::MakeLazy() { … }
EventListener::EventListener(const std::string& event_name,
const ExtensionId& extension_id,
const GURL& listener_url,
content::RenderProcessHost* process,
content::BrowserContext* browser_context,
bool is_for_service_worker,
int64_t service_worker_version_id,
int worker_thread_id,
std::optional<base::Value::Dict> filter)
: … { … }
EventListenerMap::EventListenerMap(Delegate* delegate)
: … { … }
EventListenerMap::~EventListenerMap() = default;
bool EventListenerMap::AddListener(std::unique_ptr<EventListener> listener) { … }
std::unique_ptr<EventMatcher> EventListenerMap::ParseEventMatcher(
const base::Value::Dict& filter_dict) { … }
bool EventListenerMap::RemoveListener(const EventListener* listener) { … }
bool EventListenerMap::HasListenerForEvent(
const std::string& event_name) const { … }
bool EventListenerMap::HasListenerForExtension(
const ExtensionId& extension_id,
const std::string& event_name) const { … }
bool EventListenerMap::HasListenerForURL(const GURL& url,
const std::string& event_name) const { … }
bool EventListenerMap::HasListener(const EventListener* listener) const { … }
bool EventListenerMap::HasProcessListener(
content::RenderProcessHost* process,
int worker_thread_id,
const ExtensionId& extension_id) const { … }
bool EventListenerMap::HasProcessListenerForEvent(
content::RenderProcessHost* process,
int worker_thread_id,
const ExtensionId& extension_id,
const std::string& event_name) const { … }
void EventListenerMap::RemoveListenersForExtension(
const ExtensionId& extension_id) { … }
void EventListenerMap::LoadUnfilteredLazyListeners(
content::BrowserContext* browser_context,
const ExtensionId& extension_id,
bool is_for_service_worker,
const std::set<std::string>& event_names) { … }
void EventListenerMap::LoadFilteredLazyListeners(
content::BrowserContext* browser_context,
const ExtensionId& extension_id,
bool is_for_service_worker,
const base::Value::Dict& filtered) { … }
std::set<const EventListener*> EventListenerMap::GetEventListeners(
const Event& event) { … }
void EventListenerMap::RemoveListenersForProcess(
const content::RenderProcessHost* process) { … }
void EventListenerMap::CleanupListener(EventListener* listener) { … }
bool EventListenerMap::IsFilteredEvent(const Event& event) const { … }
}