| 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 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 if (pending_) | 536 if (pending_) |
| 537 pending_->Detach(session_id); | 537 pending_->Detach(session_id); |
| 538 OnClientDetached(); | 538 OnClientDetached(); |
| 539 } | 539 } |
| 540 | 540 |
| 541 bool RenderFrameDevToolsAgentHost::DispatchProtocolMessage( | 541 bool RenderFrameDevToolsAgentHost::DispatchProtocolMessage( |
| 542 DevToolsSession* session, | 542 DevToolsSession* session, |
| 543 const std::string& message) { | 543 const std::string& message) { |
| 544 int call_id = 0; | 544 int call_id = 0; |
| 545 std::string method; | 545 std::string method; |
| 546 if (session->Dispatch(message, true, &call_id, &method) != | 546 if (session->Dispatch(message, &call_id, &method) != |
| 547 protocol::Response::kFallThrough) { | 547 protocol::Response::kFallThrough) { |
| 548 return true; | 548 return true; |
| 549 } | 549 } |
| 550 | 550 |
| 551 if (!navigating_handles_.empty()) { | 551 if (!navigating_handles_.empty()) { |
| 552 DCHECK(IsBrowserSideNavigationEnabled()); | 552 DCHECK(IsBrowserSideNavigationEnabled()); |
| 553 in_navigation_protocol_message_buffer_[call_id] = | 553 in_navigation_protocol_message_buffer_[call_id] = |
| 554 { session->session_id(), method, message }; | 554 { session->session_id(), method, message }; |
| 555 return true; | 555 return true; |
| 556 } | 556 } |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 pair.second.session_id, pair.first, pair.second.method, | 921 pair.second.session_id, pair.first, pair.second.method, |
| 922 pair.second.message); | 922 pair.second.message); |
| 923 } | 923 } |
| 924 in_navigation_protocol_message_buffer_.clear(); | 924 in_navigation_protocol_message_buffer_.clear(); |
| 925 } | 925 } |
| 926 } | 926 } |
| 927 | 927 |
| 928 void RenderFrameDevToolsAgentHost::UpdateProtocolHandlers( | 928 void RenderFrameDevToolsAgentHost::UpdateProtocolHandlers( |
| 929 RenderFrameHostImpl* host) { | 929 RenderFrameHostImpl* host) { |
| 930 #if DCHECK_IS_ON() | 930 #if DCHECK_IS_ON() |
| 931 // Check that we don't have stale host object here by accessing some random | 931 // TODO(dgozman): fix this for browser side navigation. |
| 932 // properties inside. | 932 if (!IsBrowserSideNavigationEnabled()) { |
| 933 if (handlers_frame_host_ && handlers_frame_host_->GetRenderWidgetHost()) | 933 // Check that we don't have stale host object here by accessing some random |
| 934 handlers_frame_host_->GetRenderWidgetHost()->GetRoutingID(); | 934 // properties inside. |
| 935 if (handlers_frame_host_ && handlers_frame_host_->GetRenderWidgetHost()) |
| 936 handlers_frame_host_->GetRenderWidgetHost()->GetRoutingID(); |
| 937 } |
| 935 #endif | 938 #endif |
| 936 handlers_frame_host_ = host; | 939 handlers_frame_host_ = host; |
| 937 if (session()) | 940 if (session()) |
| 938 session()->SetRenderFrameHost(host); | 941 session()->SetRenderFrameHost(host); |
| 939 } | 942 } |
| 940 | 943 |
| 941 void RenderFrameDevToolsAgentHost::DisconnectWebContents() { | 944 void RenderFrameDevToolsAgentHost::DisconnectWebContents() { |
| 942 if (pending_) | 945 if (pending_) |
| 943 DiscardPending(); | 946 DiscardPending(); |
| 944 UpdateProtocolHandlers(nullptr); | 947 UpdateProtocolHandlers(nullptr); |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1162 RenderFrameHost* host) { | 1165 RenderFrameHost* host) { |
| 1163 return (current_ && current_->host() == host) || | 1166 return (current_ && current_->host() == host) || |
| 1164 (pending_ && pending_->host() == host); | 1167 (pending_ && pending_->host() == host); |
| 1165 } | 1168 } |
| 1166 | 1169 |
| 1167 bool RenderFrameDevToolsAgentHost::IsChildFrame() { | 1170 bool RenderFrameDevToolsAgentHost::IsChildFrame() { |
| 1168 return current_ && current_->host()->GetParent(); | 1171 return current_ && current_->host()->GetParent(); |
| 1169 } | 1172 } |
| 1170 | 1173 |
| 1171 } // namespace content | 1174 } // namespace content |
| OLD | NEW |