#include "extensions/renderer/bindings/api_bindings_system.h"
#include <utility>
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/not_fatal_until.h"
#include "base/values.h"
#include "extensions/common/mojom/event_dispatcher.mojom.h"
#include "extensions/renderer/bindings/api_binding_hooks.h"
#include "extensions/renderer/bindings/api_binding_hooks_delegate.h"
#include "extensions/renderer/bindings/api_binding_util.h"
#include "extensions/renderer/bindings/api_response_validator.h"
#include "extensions/renderer/bindings/interaction_provider.h"
namespace extensions {
APIBindingsSystem::APIBindingsSystem(
GetAPISchemaMethod get_api_schema,
BindingAccessChecker::APIAvailabilityCallback api_available,
BindingAccessChecker::PromiseAvailabilityCallback promises_available,
APIRequestHandler::SendRequestMethod send_request,
std::unique_ptr<InteractionProvider> interaction_provider,
APIEventListeners::ListenersUpdated event_listeners_changed,
APIEventHandler::ContextOwnerIdGetter context_owner_getter,
APIBinding::OnSilentRequest on_silent_request,
binding::AddConsoleError add_console_error,
APILastError last_error)
: … { … }
APIBindingsSystem::~APIBindingsSystem() = default;
v8::Local<v8::Object> APIBindingsSystem::CreateAPIInstance(
const std::string& api_name,
v8::Local<v8::Context> context,
APIBindingHooks** hooks_out) { … }
std::unique_ptr<APIBinding> APIBindingsSystem::CreateNewAPIBinding(
const std::string& api_name) { … }
void APIBindingsSystem::InitializeType(const std::string& type_name) { … }
void APIBindingsSystem::CompleteRequest(
int request_id,
const base::Value::List& response,
const std::string& error,
mojom::ExtraResponseDataPtr extra_data) { … }
void APIBindingsSystem::FireEventInContext(
const std::string& event_name,
v8::Local<v8::Context> context,
const base::Value::List& response,
mojom::EventFilteringInfoPtr filter) { … }
void APIBindingsSystem::RegisterHooksDelegate(
const std::string& api_name,
std::unique_ptr<APIBindingHooksDelegate> delegate) { … }
void APIBindingsSystem::RegisterCustomType(const std::string& type_name,
CustomTypeHandler function) { … }
void APIBindingsSystem::WillReleaseContext(v8::Local<v8::Context> context) { … }
v8::Local<v8::Object> APIBindingsSystem::CreateCustomType(
v8::Isolate* isolate,
const std::string& type_name,
const std::string& property_name,
const base::Value::List* property_values) { … }
}