Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Unified Diff: headless/lib/browser/headless_web_contents_impl.cc

Issue 2830753004: Pipe the devTools FrameId from blink into the browser for headless (Closed)
Patch Set: Rebased Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « headless/lib/browser/headless_web_contents_impl.h ('k') | headless/lib/frame_id_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: headless/lib/browser/headless_web_contents_impl.cc
diff --git a/headless/lib/browser/headless_web_contents_impl.cc b/headless/lib/browser/headless_web_contents_impl.cc
index 508302cc0ba708893ac0ef43646e1a2faf7d844b..fe9cbd461fbcbea8e56678cf0d8cc278d0b8f8f6 100644
--- a/headless/lib/browser/headless_web_contents_impl.cc
+++ b/headless/lib/browser/headless_web_contents_impl.cc
@@ -216,6 +216,10 @@ void HeadlessWebContentsImpl::RenderFrameCreated(
browser()->BrowserMainThread());
}
+ browser_context_->SetFrameTreeNodeId(render_frame_host->GetProcess()->GetID(),
+ render_frame_host->GetRoutingID(),
+ render_frame_host->GetFrameTreeNodeId());
+
std::string devtools_agent_host_id =
content::DevToolsAgentHost::GetOrCreateFor(render_frame_host)->GetId();
render_frame_host_to_devtools_agent_host_id_[render_frame_host] =
@@ -226,6 +230,10 @@ void HeadlessWebContentsImpl::RenderFrameCreated(
void HeadlessWebContentsImpl::RenderFrameDeleted(
content::RenderFrameHost* render_frame_host) {
+ browser_context_->RemoveFrameTreeNode(
+ render_frame_host->GetProcess()->GetID(),
+ render_frame_host->GetRoutingID());
+
auto find_it =
render_frame_host_to_devtools_agent_host_id_.find(render_frame_host);
if (find_it == render_frame_host_to_devtools_agent_host_id_.end())
@@ -246,6 +254,19 @@ bool HeadlessWebContentsImpl::GetFrameTreeNodeIdForDevToolsAgentHostId(
return true;
}
+std::string
+HeadlessWebContentsImpl::GetUntrustedDevToolsFrameIdForFrameTreeNodeId(
+ int process_id,
+ int frame_tree_node_id) const {
+ return content::DevToolsAgentHost::
+ GetUntrustedDevToolsFrameIdForFrameTreeNodeId(process_id,
+ frame_tree_node_id);
+}
+
+int HeadlessWebContentsImpl::GetMainFrameRenderProcessId() const {
+ return web_contents()->GetMainFrame()->GetProcess()->GetID();
+}
+
bool HeadlessWebContentsImpl::OpenURL(const GURL& url) {
if (!url.is_valid())
return false;
« no previous file with comments | « headless/lib/browser/headless_web_contents_impl.h ('k') | headless/lib/frame_id_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698