#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
#endif
#include "extensions/common/mojom/event_router.mojom.h"
#include <math.h>
#include <stdint.h>
#include <utility>
#include "base/debug/alias.h"
#include "base/hash/md5_constexpr.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/typed_macros.h"
#include "mojo/public/cpp/bindings/features.h"
#include "mojo/public/cpp/bindings/lib/default_construct_tag_internal.h"
#include "mojo/public/cpp/bindings/lib/generated_code_util.h"
#include "mojo/public/cpp/bindings/lib/message_internal.h"
#include "mojo/public/cpp/bindings/lib/proxy_to_responder.h"
#include "mojo/public/cpp/bindings/lib/send_message_helper.h"
#include "mojo/public/cpp/bindings/lib/serialization_util.h"
#include "mojo/public/cpp/bindings/lib/unserialized_message_context.h"
#include "mojo/public/cpp/bindings/lib/validate_params.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/mojo_buildflags.h"
#include "mojo/public/cpp/bindings/urgent_message_scope.h"
#include "mojo/public/interfaces/bindings/interface_control_messages.mojom.h"
#include "third_party/perfetto/include/perfetto/tracing/traced_value.h"
#include "extensions/common/mojom/event_router.mojom-params-data.h"
#include "extensions/common/mojom/event_router.mojom-shared-message-ids.h"
#include "extensions/common/mojom/event_router.mojom-import-headers.h"
#include "extensions/common/mojom/event_router.mojom-test-utils.h"
namespace extensions::mojom {
ServiceWorkerContext::ServiceWorkerContext()
: … { … }
ServiceWorkerContext::ServiceWorkerContext(
const ::GURL& scope_url_in,
int64_t version_id_in,
int32_t thread_id_in)
: … { … }
ServiceWorkerContext::~ServiceWorkerContext() = default;
void ServiceWorkerContext::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool ServiceWorkerContext::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
EventListener::EventListener()
: … { … }
EventListener::EventListener(
EventListenerOwnerPtr listener_owner_in,
const std::string& event_name_in,
ServiceWorkerContextPtr service_worker_context_in,
std::optional<::base::Value::Dict> filter_in)
: … { … }
EventListener::~EventListener() = default;
void EventListener::WriteIntoTrace(
perfetto::TracedValue traced_context) const { … }
bool EventListener::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
EventListenerOwner::EventListenerOwner() : … { … }
EventListenerOwner::~EventListenerOwner() { … }
void EventListenerOwner::set_extension_id(
const std::string& extension_id) { … }
void EventListenerOwner::set_listener_url(
const ::GURL& listener_url) { … }
void EventListenerOwner::DestroyActive() { … }
bool EventListenerOwner::Validate(
const void* data,
mojo::internal::ValidationContext* validation_context) { … }
const char EventRouter::Name_[] = …;
EventRouter::IPCStableHashFunction EventRouter::MessageToMethodInfo_(mojo::Message& message) { … }
const char* EventRouter::MessageToMethodName_(mojo::Message& message) { … }
#if !BUILDFLAG(IS_FUCHSIA)
uint32_t EventRouter::AddListenerForMainThread_Sym::IPCStableHash() { … }
uint32_t EventRouter::AddListenerForServiceWorker_Sym::IPCStableHash() { … }
uint32_t EventRouter::AddLazyListenerForMainThread_Sym::IPCStableHash() { … }
uint32_t EventRouter::AddLazyListenerForServiceWorker_Sym::IPCStableHash() { … }
uint32_t EventRouter::AddFilteredListenerForMainThread_Sym::IPCStableHash() { … }
uint32_t EventRouter::AddFilteredListenerForServiceWorker_Sym::IPCStableHash() { … }
uint32_t EventRouter::RemoveListenerForMainThread_Sym::IPCStableHash() { … }
uint32_t EventRouter::RemoveListenerForServiceWorker_Sym::IPCStableHash() { … }
uint32_t EventRouter::RemoveLazyListenerForMainThread_Sym::IPCStableHash() { … }
uint32_t EventRouter::RemoveLazyListenerForServiceWorker_Sym::IPCStableHash() { … }
uint32_t EventRouter::RemoveFilteredListenerForMainThread_Sym::IPCStableHash() { … }
uint32_t EventRouter::RemoveFilteredListenerForServiceWorker_Sym::IPCStableHash() { … }
# endif
EventRouterProxy::EventRouterProxy(mojo::MessageReceiverWithResponder* receiver)
: … { … }
void EventRouterProxy::AddListenerForMainThread(
EventListenerPtr in_event_listener) { … }
void EventRouterProxy::AddListenerForServiceWorker(
EventListenerPtr in_event_listener) { … }
void EventRouterProxy::AddLazyListenerForMainThread(
const std::string& in_extension_id, const std::string& in_event_name) { … }
void EventRouterProxy::AddLazyListenerForServiceWorker(
const std::string& in_extension_id, const ::GURL& in_worker_scope_url, const std::string& in_event_name) { … }
void EventRouterProxy::AddFilteredListenerForMainThread(
EventListenerOwnerPtr in_listener_owner, const std::string& in_event_name, ::base::Value::Dict in_filter, bool in_add_lazy_listener) { … }
void EventRouterProxy::AddFilteredListenerForServiceWorker(
const std::string& in_extension_id, const std::string& in_event_name, ServiceWorkerContextPtr in_service_worker_context, ::base::Value::Dict in_filter, bool in_add_lazy_listener) { … }
void EventRouterProxy::RemoveListenerForMainThread(
EventListenerPtr in_event_listener) { … }
void EventRouterProxy::RemoveListenerForServiceWorker(
EventListenerPtr in_event_listener) { … }
void EventRouterProxy::RemoveLazyListenerForMainThread(
const std::string& in_extension_id, const std::string& in_event_name) { … }
void EventRouterProxy::RemoveLazyListenerForServiceWorker(
const std::string& in_extension_id, const ::GURL& in_worker_scope_url, const std::string& in_event_name) { … }
void EventRouterProxy::RemoveFilteredListenerForMainThread(
EventListenerOwnerPtr in_listener_owner, const std::string& in_event_name, ::base::Value::Dict in_filter, bool in_remove_lazy_listener) { … }
void EventRouterProxy::RemoveFilteredListenerForServiceWorker(
const std::string& in_extension_id, const std::string& in_event_name, ServiceWorkerContextPtr in_service_worker_context, ::base::Value::Dict in_filter, bool in_remove_lazy_listener) { … }
bool EventRouterStubDispatch::Accept(
EventRouter* impl,
mojo::Message* message) { … }
bool EventRouterStubDispatch::AcceptWithResponder(
EventRouter* impl,
mojo::Message* message,
std::unique_ptr<mojo::MessageReceiverWithStatus> responder) { … }
namespace {
}
static const mojo::internal::GenericValidationInfo kEventRouterValidationInfo[] = …;
bool EventRouterRequestValidator::Accept(mojo::Message* message) { … }
}
namespace mojo {
bool StructTraits<::extensions::mojom::ServiceWorkerContext::DataView, ::extensions::mojom::ServiceWorkerContextPtr>::Read(
::extensions::mojom::ServiceWorkerContext::DataView input,
::extensions::mojom::ServiceWorkerContextPtr* output) { … }
bool StructTraits<::extensions::mojom::EventListener::DataView, ::extensions::mojom::EventListenerPtr>::Read(
::extensions::mojom::EventListener::DataView input,
::extensions::mojom::EventListenerPtr* output) { … }
bool UnionTraits<::extensions::mojom::EventListenerOwner::DataView, ::extensions::mojom::EventListenerOwnerPtr>::Read(
::extensions::mojom::EventListenerOwner::DataView input,
::extensions::mojom::EventListenerOwnerPtr* output) { … }
}
namespace extensions::mojom {
void EventRouterInterceptorForTesting::AddListenerForMainThread(EventListenerPtr event_listener) { … }
void EventRouterInterceptorForTesting::AddListenerForServiceWorker(EventListenerPtr event_listener) { … }
void EventRouterInterceptorForTesting::AddLazyListenerForMainThread(const std::string& extension_id, const std::string& event_name) { … }
void EventRouterInterceptorForTesting::AddLazyListenerForServiceWorker(const std::string& extension_id, const ::GURL& worker_scope_url, const std::string& event_name) { … }
void EventRouterInterceptorForTesting::AddFilteredListenerForMainThread(EventListenerOwnerPtr listener_owner, const std::string& event_name, ::base::Value::Dict filter, bool add_lazy_listener) { … }
void EventRouterInterceptorForTesting::AddFilteredListenerForServiceWorker(const std::string& extension_id, const std::string& event_name, ServiceWorkerContextPtr service_worker_context, ::base::Value::Dict filter, bool add_lazy_listener) { … }
void EventRouterInterceptorForTesting::RemoveListenerForMainThread(EventListenerPtr event_listener) { … }
void EventRouterInterceptorForTesting::RemoveListenerForServiceWorker(EventListenerPtr event_listener) { … }
void EventRouterInterceptorForTesting::RemoveLazyListenerForMainThread(const std::string& extension_id, const std::string& event_name) { … }
void EventRouterInterceptorForTesting::RemoveLazyListenerForServiceWorker(const std::string& extension_id, const ::GURL& worker_scope_url, const std::string& event_name) { … }
void EventRouterInterceptorForTesting::RemoveFilteredListenerForMainThread(EventListenerOwnerPtr listener_owner, const std::string& event_name, ::base::Value::Dict filter, bool remove_lazy_listener) { … }
void EventRouterInterceptorForTesting::RemoveFilteredListenerForServiceWorker(const std::string& extension_id, const std::string& event_name, ServiceWorkerContextPtr service_worker_context, ::base::Value::Dict filter, bool remove_lazy_listener) { … }
EventRouterAsyncWaiter::EventRouterAsyncWaiter(
EventRouter* proxy) : … { … }
EventRouterAsyncWaiter::~EventRouterAsyncWaiter() = default;
}
#if defined(__clang__)
#pragma clang diagnostic pop
#endif