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

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: Changes for dgozman@ 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
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 07492082253fda0adb7a0c103042b449294941c1..fe66aa55520bbba2efda2263dad7a379b70edda2 100644
--- a/headless/lib/browser/headless_web_contents_impl.cc
+++ b/headless/lib/browser/headless_web_contents_impl.cc
@@ -216,6 +216,12 @@ void HeadlessWebContentsImpl::RenderFrameCreated(
browser()->BrowserMainThread());
}
+ browser_context_->SetFrameTreeNodeId(render_frame_host->GetProcess()->GetID(),
+ render_frame_host->GetRoutingID(),
+ render_frame_host->GetFrameTreeNodeId());
+
+ void RemoveFrameTreeNode(int render_process_id, int render_frame_id);
Sami 2017/04/26 16:21:17 Probably did not mean to have this here?
alex clarke (OOO till 29th) 2017/04/27 08:49:44 Done.
+
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 +232,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 +256,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::GetRenderProcessId() const {
+ return web_contents()->GetRenderProcessHost()->GetID();
+}
+
bool HeadlessWebContentsImpl::OpenURL(const GURL& url) {
if (!url.is_valid())
return false;

Powered by Google App Engine
This is Rietveld 408576698