#include "chrome/renderer/extensions/api/extension_hooks_delegate.h"
#include <string_view>
#include "content/public/renderer/v8_value_converter.h"
#include "extensions/common/api/messaging/message.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest.h"
#include "extensions/common/mojom/message_port.mojom-shared.h"
#include "extensions/common/mojom/view_type.mojom.h"
#include "extensions/common/view_type_util.h"
#include "extensions/renderer/api/messaging/message_target.h"
#include "extensions/renderer/api/messaging/messaging_util.h"
#include "extensions/renderer/api/messaging/native_renderer_messaging_service.h"
#include "extensions/renderer/api/runtime_hooks_delegate.h"
#include "extensions/renderer/bindings/api_binding_types.h"
#include "extensions/renderer/extension_frame_helper.h"
#include "extensions/renderer/extensions_renderer_client.h"
#include "extensions/renderer/get_script_context.h"
#include "extensions/renderer/script_context.h"
#include "gin/converter.h"
#include "gin/dictionary.h"
namespace extensions {
namespace {
RequestResult;
constexpr char kSendExtensionRequest[] = …;
constexpr char kGetURL[] = …;
constexpr char kGetBackgroundPage[] = …;
constexpr char kGetViews[] = …;
constexpr char kGetExtensionTabs[] = …;
void GetAliasedFeature(v8::Local<v8::Name> property_name,
const v8::PropertyCallbackInfo<v8::Value>& info) { … }
void ThrowDeprecatedAccessError(
v8::Local<v8::Name> name,
const v8::PropertyCallbackInfo<v8::Value>& info) { … }
void EmptySetterCallback(v8::Local<v8::Name> name,
v8::Local<v8::Value> value,
const v8::PropertyCallbackInfo<void>& info) { … }
}
ExtensionHooksDelegate::ExtensionHooksDelegate(
NativeRendererMessagingService* messaging_service)
: … { … }
ExtensionHooksDelegate::~ExtensionHooksDelegate() { … }
RequestResult ExtensionHooksDelegate::HandleRequest(
const std::string& method_name,
const APISignature* signature,
v8::Local<v8::Context> context,
v8::LocalVector<v8::Value>* arguments,
const APITypeReferenceMap& refs) { … }
void ExtensionHooksDelegate::InitializeTemplate(
v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> object_template,
const APITypeReferenceMap& type_refs) { … }
void ExtensionHooksDelegate::InitializeInstance(
v8::Local<v8::Context> context,
v8::Local<v8::Object> instance) { … }
RequestResult ExtensionHooksDelegate::HandleSendRequest(
ScriptContext* script_context,
const APISignature::V8ParseResult& parse_result) { … }
RequestResult ExtensionHooksDelegate::HandleGetURL(
ScriptContext* script_context,
const APISignature::V8ParseResult& parse_result) { … }
APIBindingHooks::RequestResult ExtensionHooksDelegate::HandleGetViews(
ScriptContext* script_context,
const APISignature::V8ParseResult& parse_result) { … }
RequestResult ExtensionHooksDelegate::HandleGetExtensionTabs(
ScriptContext* script_context,
const APISignature::V8ParseResult& parse_result) { … }
RequestResult ExtensionHooksDelegate::HandleGetBackgroundPage(
ScriptContext* script_context,
const APISignature::V8ParseResult& parse_result) { … }
}