#include "extensions/browser/extension_frame_host.h"
#include <string>
#include "base/trace_event/typed_macros.h"
#include "content/public/browser/render_process_host.h"
#include "extensions/browser/bad_message.h"
#include "extensions/browser/extension_function_dispatcher.h"
#include "extensions/browser/extension_host.h"
#include "extensions/browser/extension_web_contents_observer.h"
#include "extensions/browser/message_service_api.h"
#include "extensions/browser/process_manager.h"
#include "extensions/buildflags/buildflags.h"
#include "extensions/common/api/messaging/port_context.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/mojom/message_port.mojom.h"
#include "extensions/common/trace_util.h"
#include "third_party/blink/public/mojom/page/draggable_region.mojom.h"
#if BUILDFLAG(ENABLE_PLATFORM_APPS)
#include "extensions/browser/app_window/app_window.h"
#include "extensions/browser/app_window/app_window_registry.h"
#endif
ChromeTrackEvent;
namespace extensions {
ExtensionFrameHost::ExtensionFrameHost(content::WebContents* web_contents)
: … { … }
ExtensionFrameHost::~ExtensionFrameHost() = default;
void ExtensionFrameHost::BindLocalFrameHost(
mojo::PendingAssociatedReceiver<mojom::LocalFrameHost> receiver,
content::RenderFrameHost* render_frame_host) { … }
void ExtensionFrameHost::RequestScriptInjectionPermission(
const ExtensionId& extension_id,
mojom::InjectionType script_type,
mojom::RunLocation run_location,
RequestScriptInjectionPermissionCallback callback) { … }
void ExtensionFrameHost::GetAppInstallState(
const GURL& requestor_url,
GetAppInstallStateCallback callback) { … }
void ExtensionFrameHost::Request(mojom::RequestParamsPtr params,
RequestCallback callback) { … }
void ExtensionFrameHost::ResponseAck(const base::Uuid& request_uuid) { … }
void ExtensionFrameHost::WatchedPageChange(
const std::vector<std::string>& css_selectors) { … }
void ExtensionFrameHost::DetailedConsoleMessageAdded(
const std::u16string& message,
const std::u16string& source,
const StackTrace& stack_trace,
blink::mojom::ConsoleMessageLevel level) { … }
void ExtensionFrameHost::ContentScriptsExecuting(
const base::flat_map<std::string, std::vector<std::string>>&
extension_id_to_scripts,
const GURL& frame_url) { … }
void ExtensionFrameHost::IncrementLazyKeepaliveCount() { … }
void ExtensionFrameHost::DecrementLazyKeepaliveCount() { … }
const Extension* ExtensionFrameHost::GetExtension(
ProcessManager* process_manager,
content::RenderFrameHost* frame) { … }
void ExtensionFrameHost::AppWindowReady() { … }
void ExtensionFrameHost::OpenChannelToExtension(
extensions::mojom::ExternalConnectionInfoPtr info,
extensions::mojom::ChannelType channel_type,
const std::string& channel_name,
const PortId& port_id,
mojo::PendingAssociatedRemote<extensions::mojom::MessagePort> port,
mojo::PendingAssociatedReceiver<extensions::mojom::MessagePortHost>
port_host) { … }
void ExtensionFrameHost::OpenChannelToNativeApp(
const std::string& native_app_name,
const PortId& port_id,
mojo::PendingAssociatedRemote<extensions::mojom::MessagePort> port,
mojo::PendingAssociatedReceiver<extensions::mojom::MessagePortHost>
port_host) { … }
void ExtensionFrameHost::OpenChannelToTab(
int32_t tab_id,
int32_t frame_id,
const std::optional<std::string>& document_id,
extensions::mojom::ChannelType channel_type,
const std::string& channel_name,
const PortId& port_id,
mojo::PendingAssociatedRemote<extensions::mojom::MessagePort> port,
mojo::PendingAssociatedReceiver<extensions::mojom::MessagePortHost>
port_host) { … }
}