| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/forwarding_agent_host.h" | 5 #include "content/browser/devtools/forwarding_agent_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "content/browser/devtools/devtools_session.h" | 8 #include "content/browser/devtools/devtools_session.h" |
| 9 #include "content/browser/devtools/protocol/inspector_handler.h" | 9 #include "content/browser/devtools/protocol/inspector_handler.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 ForwardingAgentHost::ForwardingAgentHost( | 13 ForwardingAgentHost::ForwardingAgentHost( |
| 14 const std::string& id, | 14 const std::string& id, |
| 15 std::unique_ptr<DevToolsExternalAgentProxyDelegate> delegate) | 15 std::unique_ptr<DevToolsExternalAgentProxyDelegate> delegate) |
| 16 : DevToolsAgentHostImpl(id), | 16 : DevToolsAgentHostImpl(id), |
| 17 delegate_(std::move(delegate)) { | 17 delegate_(std::move(delegate)) { |
| 18 NotifyCreated(); | 18 NotifyCreated(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 ForwardingAgentHost::~ForwardingAgentHost() { | 21 ForwardingAgentHost::~ForwardingAgentHost() { |
| 22 } | 22 } |
| 23 | 23 |
| 24 void ForwardingAgentHost::DispatchOnClientHost(const std::string& message) { | 24 void ForwardingAgentHost::DispatchOnClientHost(const std::string& message) { |
| 25 SendMessageToClient(session() ? session()->session_id() : 0, message); | 25 if (session()) |
| 26 session()->SendMessageToClient(message); |
| 26 } | 27 } |
| 27 | 28 |
| 28 void ForwardingAgentHost::ConnectionClosed() { | 29 void ForwardingAgentHost::ConnectionClosed() { |
| 29 ForceDetach(false); | 30 ForceDetach(false); |
| 30 } | 31 } |
| 31 | 32 |
| 32 void ForwardingAgentHost::AttachSession(DevToolsSession* session) { | 33 void ForwardingAgentHost::AttachSession(DevToolsSession* session) { |
| 33 delegate_->Attach(this); | 34 delegate_->Attach(this); |
| 34 } | 35 } |
| 35 | 36 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 75 |
| 75 bool ForwardingAgentHost::Close() { | 76 bool ForwardingAgentHost::Close() { |
| 76 return delegate_->Close(); | 77 return delegate_->Close(); |
| 77 } | 78 } |
| 78 | 79 |
| 79 base::TimeTicks ForwardingAgentHost::GetLastActivityTime() { | 80 base::TimeTicks ForwardingAgentHost::GetLastActivityTime() { |
| 80 return delegate_->GetLastActivityTime(); | 81 return delegate_->GetLastActivityTime(); |
| 81 } | 82 } |
| 82 | 83 |
| 83 } // content | 84 } // content |
| OLD | NEW |