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/protocol/inspector_handler.h" | 9 #include "content/browser/devtools/protocol/inspector_handler.h" |
9 | 10 |
10 namespace content { | 11 namespace content { |
11 | 12 |
12 ForwardingAgentHost::ForwardingAgentHost( | 13 ForwardingAgentHost::ForwardingAgentHost( |
13 const std::string& id, | 14 const std::string& id, |
14 std::unique_ptr<DevToolsExternalAgentProxyDelegate> delegate) | 15 std::unique_ptr<DevToolsExternalAgentProxyDelegate> delegate) |
15 : DevToolsAgentHostImpl(id), | 16 : DevToolsAgentHostImpl(id), |
16 delegate_(std::move(delegate)) { | 17 delegate_(std::move(delegate)) { |
17 NotifyCreated(); | 18 NotifyCreated(); |
18 } | 19 } |
19 | 20 |
20 ForwardingAgentHost::~ForwardingAgentHost() { | 21 ForwardingAgentHost::~ForwardingAgentHost() { |
21 } | 22 } |
22 | 23 |
23 void ForwardingAgentHost::DispatchOnClientHost(const std::string& message) { | 24 void ForwardingAgentHost::DispatchOnClientHost(const std::string& message) { |
24 SendMessageToClient(session_id(), message); | 25 SendMessageToClient(session() ? session()->session_id() : 0, message); |
25 } | 26 } |
26 | 27 |
27 void ForwardingAgentHost::ConnectionClosed() { | 28 void ForwardingAgentHost::ConnectionClosed() { |
28 HostClosed(); | 29 HostClosed(); |
29 } | 30 } |
30 | 31 |
31 void ForwardingAgentHost::Attach() { | 32 void ForwardingAgentHost::Attach() { |
32 delegate_->Attach(this); | 33 delegate_->Attach(this); |
33 } | 34 } |
34 | 35 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 69 |
69 void ForwardingAgentHost::Reload() { | 70 void ForwardingAgentHost::Reload() { |
70 delegate_->Reload(); | 71 delegate_->Reload(); |
71 } | 72 } |
72 | 73 |
73 bool ForwardingAgentHost::Close() { | 74 bool ForwardingAgentHost::Close() { |
74 return delegate_->Close(); | 75 return delegate_->Close(); |
75 } | 76 } |
76 | 77 |
77 } // content | 78 } // content |
OLD | NEW |