#include "extensions/renderer/bindings/api_binding_js_util.h"
#include <optional>
#include "base/strings/stringprintf.h"
#include "base/values.h"
#include "content/public/renderer/v8_value_converter.h"
#include "extensions/renderer/bindings/api_event_handler.h"
#include "extensions/renderer/bindings/api_request_handler.h"
#include "extensions/renderer/bindings/api_signature.h"
#include "extensions/renderer/bindings/api_type_reference_map.h"
#include "extensions/renderer/bindings/argument_spec.h"
#include "extensions/renderer/bindings/declarative_event.h"
#include "extensions/renderer/bindings/exception_handler.h"
#include "extensions/renderer/bindings/js_runner.h"
#include "gin/converter.h"
#include "gin/dictionary.h"
#include "gin/handle.h"
#include "gin/object_template_builder.h"
namespace extensions {
gin::WrapperInfo APIBindingJSUtil::kWrapperInfo = …;
APIBindingJSUtil::APIBindingJSUtil(APITypeReferenceMap* type_refs,
APIRequestHandler* request_handler,
APIEventHandler* event_handler,
ExceptionHandler* exception_handler)
: … { … }
APIBindingJSUtil::~APIBindingJSUtil() = default;
gin::ObjectTemplateBuilder APIBindingJSUtil::GetObjectTemplateBuilder(
v8::Isolate* isolate) { … }
void APIBindingJSUtil::SendRequest(
gin::Arguments* arguments,
const std::string& name,
const v8::LocalVector<v8::Value>& request_args,
v8::Local<v8::Value> options) { … }
void APIBindingJSUtil::RegisterEventArgumentMassager(
gin::Arguments* arguments,
const std::string& event_name,
v8::Local<v8::Function> massager) { … }
void APIBindingJSUtil::CreateCustomEvent(gin::Arguments* arguments,
v8::Local<v8::Value> v8_event_name,
bool supports_filters,
bool supports_lazy_listeners) { … }
void APIBindingJSUtil::CreateCustomDeclarativeEvent(
gin::Arguments* arguments,
const std::string& event_name,
const std::vector<std::string>& actions_list,
const std::vector<std::string>& conditions_list,
int webview_instance_id) { … }
void APIBindingJSUtil::InvalidateEvent(gin::Arguments* arguments,
v8::Local<v8::Object> event) { … }
void APIBindingJSUtil::SetLastError(gin::Arguments* arguments,
const std::string& error) { … }
void APIBindingJSUtil::ClearLastError(gin::Arguments* arguments) { … }
void APIBindingJSUtil::HasLastError(gin::Arguments* arguments) { … }
void APIBindingJSUtil::GetLastErrorMessage(gin::Arguments* arguments) { … }
void APIBindingJSUtil::RunCallbackWithLastError(
gin::Arguments* arguments,
const std::string& error,
v8::Local<v8::Function> callback) { … }
void APIBindingJSUtil::HandleException(gin::Arguments* arguments,
const std::string& message,
v8::Local<v8::Value> exception) { … }
void APIBindingJSUtil::SetExceptionHandler(gin::Arguments* arguments,
v8::Local<v8::Function> handler) { … }
void APIBindingJSUtil::ValidateType(gin::Arguments* arguments,
const std::string& type_name,
v8::Local<v8::Value> value) { … }
void APIBindingJSUtil::AddCustomSignature(
gin::Arguments* arguments,
const std::string& custom_signature_name,
v8::Local<v8::Value> signature) { … }
void APIBindingJSUtil::ValidateCustomSignature(
gin::Arguments* arguments,
const std::string& custom_signature_name,
v8::Local<v8::Value> arguments_to_validate) { … }
}