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
3 // found in the LICENSE file.
5 #include "content/browser/devtools/forwarding_agent_host.h"
8 #include "content/browser/devtools/protocol/inspector_handler.h"
12 ForwardingAgentHost::ForwardingAgentHost(
13 DevToolsExternalAgentProxyDelegate
* delegate
)
14 : delegate_(delegate
) {
17 ForwardingAgentHost::~ForwardingAgentHost() {
20 void ForwardingAgentHost::DispatchOnClientHost(const std::string
& message
) {
21 SendMessageToClient(message
);
24 void ForwardingAgentHost::ConnectionClosed() {
25 devtools::inspector::Client
inspector(
26 base::Bind(&ForwardingAgentHost::DispatchOnClientHost
,
27 base::Unretained(this)));
28 inspector
.Detached(devtools::inspector::DetachedParams::Create()
29 ->set_reason("Connection lost."));
33 void ForwardingAgentHost::Attach() {
35 delegate_
->Attach(this);
38 void ForwardingAgentHost::Detach() {
43 bool ForwardingAgentHost::DispatchProtocolMessage(
44 const std::string
& message
) {
46 delegate_
->SendMessageToBackend(message
);
50 DevToolsAgentHost::Type
ForwardingAgentHost::GetType() {
54 std::string
ForwardingAgentHost::GetTitle() {
58 GURL
ForwardingAgentHost::GetURL() {
62 bool ForwardingAgentHost::Activate() {
66 bool ForwardingAgentHost::Close() {