OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/devtools/render_frame_devtools_agent_host.h" | 5 #include "content/browser/devtools/render_frame_devtools_agent_host.h" |
6 | 6 |
7 #include <tuple> | 7 #include <tuple> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/guid.h" | 10 #include "base/guid.h" |
(...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
857 static_cast<RenderFrameHostImpl*>(wc->GetMainFrame()); | 857 static_cast<RenderFrameHostImpl*>(wc->GetMainFrame()); |
858 DCHECK(host); | 858 DCHECK(host); |
859 frame_tree_node_ = host->frame_tree_node(); | 859 frame_tree_node_ = host->frame_tree_node(); |
860 current_ = std::move(disconnected_); | 860 current_ = std::move(disconnected_); |
861 SetPending(host); | 861 SetPending(host); |
862 CommitPending(); | 862 CommitPending(); |
863 WebContentsObserver::Observe(WebContents::FromRenderFrameHost(host)); | 863 WebContentsObserver::Observe(WebContents::FromRenderFrameHost(host)); |
864 } | 864 } |
865 | 865 |
866 std::string RenderFrameDevToolsAgentHost::GetParentId() { | 866 std::string RenderFrameDevToolsAgentHost::GetParentId() { |
867 if (IsChildFrame()) { | 867 if (IsChildFrame() && current_) { |
868 RenderFrameHostImpl* frame_host = current_->host(); | 868 RenderFrameHostImpl* frame_host = current_->host()->GetParent(); |
869 while (frame_host && !ShouldCreateDevToolsFor(frame_host)) | 869 while (frame_host && !ShouldCreateDevToolsFor(frame_host)) |
870 frame_host = frame_host->GetParent(); | 870 frame_host = frame_host->GetParent(); |
871 if (frame_host) | 871 if (frame_host) |
872 return DevToolsAgentHost::GetOrCreateFor(frame_host)->GetId(); | 872 return DevToolsAgentHost::GetOrCreateFor(frame_host)->GetId(); |
873 } | 873 } |
874 | 874 |
875 WebContentsImpl* contents = static_cast<WebContentsImpl*>(web_contents()); | 875 WebContentsImpl* contents = static_cast<WebContentsImpl*>(web_contents()); |
876 if (!contents) | 876 if (!contents) |
877 return ""; | 877 return ""; |
878 contents = contents->GetOuterWebContents(); | 878 contents = contents->GetOuterWebContents(); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1026 RenderFrameHost* host) { | 1026 RenderFrameHost* host) { |
1027 return (current_ && current_->host() == host) || | 1027 return (current_ && current_->host() == host) || |
1028 (pending_ && pending_->host() == host); | 1028 (pending_ && pending_->host() == host); |
1029 } | 1029 } |
1030 | 1030 |
1031 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 1031 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
1032 return current_ && current_->host()->GetParent(); | 1032 return current_ && current_->host()->GetParent(); |
1033 } | 1033 } |
1034 | 1034 |
1035 } // namespace content | 1035 } // namespace content |
OLD | NEW |