bool BindElectronApiIPC(
    mojo::PendingAssociatedReceiver<electron::mojom::ElectronApiIPC> receiver,
    content::RenderFrameHost* frame_host) {
  auto* contents = content::WebContents::FromRenderFrameHost(frame_host);
  if (contents) {
    auto* prefs = WebContentsPreferences::From(contents);
    if (frame_host->GetFrameTreeNodeId() ==
            contents->GetMainFrame()->GetFrameTreeNodeId() ||
        (prefs && prefs->IsEnabled(options::kNodeIntegrationInSubFrames))) {
      ElectronApiIPCHandlerImpl::Create(frame_host, std::move(receiver));
      return true;
    }
  }

  return false;
}
bool BindElectronApiIPC(
    mojo::PendingAssociatedReceiver<electron::mojom::ElectronApiIPC> receiver,
    content::RenderFrameHost* frame_host) {
  auto* contents = content::WebContents::FromRenderFrameHost(frame_host);
  if (contents) {
    auto* prefs = WebContentsPreferences::From(contents);
    if (frame_host->GetFrameTreeNodeId() ==
            contents->GetMainFrame()->GetFrameTreeNodeId() ||
        (prefs && prefs->IsEnabled(options::kNodeIntegrationInSubFrames))) {
      ElectronApiIPCHandlerImpl::Create(frame_host, std::move(receiver));
      return true;
    }
  }

  return false;
}