#include "extensions/renderer/bindings/api_last_error.h"
#include <optional>
#include <tuple>
#include "gin/converter.h"
#include "gin/data_object_builder.h"
#include "gin/handle.h"
#include "gin/object_template_builder.h"
#include "gin/wrappable.h"
namespace extensions {
namespace {
constexpr char kLastErrorProperty[] = …;
constexpr char kScriptSuppliedValueKey[] = …;
constexpr char kUncheckedErrorPrefix[] = …;
class LastErrorObject final : public gin::Wrappable<LastErrorObject> { … };
gin::WrapperInfo LastErrorObject::kWrapperInfo = …;
void LastErrorGetter(v8::Local<v8::Name> property,
const v8::PropertyCallbackInfo<v8::Value>& info) { … }
void LastErrorSetter(v8::Local<v8::Name> property,
v8::Local<v8::Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
}
APILastError::APILastError(GetParent get_parent,
binding::AddConsoleError add_console_error)
: … { … }
APILastError::APILastError(APILastError&& other) = default;
APILastError::~APILastError() = default;
void APILastError::SetError(v8::Local<v8::Context> context,
const std::string& error) { … }
void APILastError::ClearError(v8::Local<v8::Context> context,
bool report_if_unchecked) { … }
bool APILastError::HasError(v8::Local<v8::Context> context) { … }
std::optional<std::string> APILastError::GetErrorMessage(
v8::Local<v8::Context> context) { … }
void APILastError::ReportUncheckedError(v8::Local<v8::Context> context,
const std::string& error) { … }
void APILastError::SetErrorOnPrimaryParent(v8::Local<v8::Context> context,
v8::Local<v8::Object> parent,
const std::string& error) { … }
void APILastError::SetErrorOnSecondaryParent(
v8::Local<v8::Context> context,
v8::Local<v8::Object> secondary_parent,
const std::string& error) { … }
}