1cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Copyright 2014 The Chromium Authors. All rights reserved.
2cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)// found in the LICENSE file.
4cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
5cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)#include "content/browser/devtools/forwarding_agent_host.h"
6cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
7cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)namespace content {
8cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
9cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)ForwardingAgentHost::ForwardingAgentHost(
10cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    DevToolsExternalAgentProxyDelegate* delegate)
11cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)      : delegate_(delegate) {
12cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}
13cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
14cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)ForwardingAgentHost::~ForwardingAgentHost() {
15cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}
16cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
17cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)void ForwardingAgentHost::DispatchOnClientHost(const std::string& message) {
1803b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)  SendMessageToClient(message);
19cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}
20cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
21cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)void ForwardingAgentHost::ConnectionClosed() {
2203b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)  HostClosed();
23cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}
24cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
25cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)void ForwardingAgentHost::Attach() {
26cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  delegate_->Attach(this);
27cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}
28cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
29cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)void ForwardingAgentHost::Detach() {
30cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  delegate_->Detach();
31cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}
32cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
3303b57e008b61dfcb1fbad3aea950ae0e001748b0Torne (Richard Coles)void ForwardingAgentHost::DispatchProtocolMessage(
34cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)    const std::string& message) {
35cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  delegate_->SendMessageToBackend(message);
36cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}
37cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
381320f92c476a1ad9d19dba2a48c72b75566198e9Primiano TucciDevToolsAgentHost::Type ForwardingAgentHost::GetType() {
391320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  return TYPE_EXTERNAL;
401320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci}
411320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
421320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccistd::string ForwardingAgentHost::GetTitle() {
431320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  return "";
441320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci}
451320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
461320f92c476a1ad9d19dba2a48c72b75566198e9Primiano TucciGURL ForwardingAgentHost::GetURL() {
471320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  return GURL();
481320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci}
491320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
501320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccibool ForwardingAgentHost::Activate() {
511320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  return false;
521320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci}
531320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
541320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tuccibool ForwardingAgentHost::Close() {
551320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci  return false;
561320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci}
571320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci
58cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)}  // content
59