summaryrefslogtreecommitdiffstats
path: root/content/browser/debugger/devtools_agent_host.h
blob: 3eb7a336b90acf655a285d45052a2d563c55cc6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_BROWSER_DEBUGGER_DEVTOOLS_AGENT_HOST_H_
#define CONTENT_BROWSER_DEBUGGER_DEVTOOLS_AGENT_HOST_H_
#pragma once

#include <map>
#include <string>

#include "content/common/content_export.h"

namespace IPC {
class Message;
}

typedef std::map<std::string, std::string> DevToolsRuntimeProperties;

// Describes interface for managing devtools agents from the browser process.
class CONTENT_EXPORT DevToolsAgentHost {
 public:
  class CONTENT_EXPORT CloseListener {
   public:
    virtual void AgentHostClosing(DevToolsAgentHost*) = 0;
   protected:
    virtual ~CloseListener() {}
  };

  // Sends the message to the devtools agent hosted by this object.
  virtual void SendMessageToAgent(IPC::Message* msg) = 0;
  virtual void Attach();
  virtual void Reattach(const std::string& saved_agent_state);
  virtual void Detach();

  // TODO(yurys): get rid of this method
  virtual void NotifyClientClosing() = 0;

  virtual int GetRenderProcessId() = 0;

  void set_close_listener(CloseListener* listener) {
    close_listener_ = listener;
  }

 protected:
  DevToolsAgentHost();
  virtual ~DevToolsAgentHost() {}

  void NotifyCloseListener();

  CloseListener* close_listener_;
};

#endif  // CONTENT_BROWSER_DEBUGGER_DEVTOOLS_AGENT_HOST_H_