summaryrefslogtreecommitdiffstats
path: root/chrome/browser/debugger/devtools_remote.h
blob: 9c7953b963052c6949de6b6168344b7571066678 (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
// Copyright (c) 2009 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 CHROME_BROWSER_DEBUGGER_DEVTOOLS_REMOTE_H_
#define CHROME_BROWSER_DEBUGGER_DEVTOOLS_REMOTE_H_
#pragma once

#include "base/basictypes.h"
#include "base/ref_counted.h"

class DevToolsRemoteMessage;
class ListenSocket;

// This interface should be implemented by a class that wants to handle
// DevToolsRemoteMessages dispatched by some entity. It must extend
class DevToolsRemoteListener
    : public base::RefCountedThreadSafe<DevToolsRemoteListener> {
 public:
  DevToolsRemoteListener() {}
  virtual void HandleMessage(const DevToolsRemoteMessage& message) = 0;
  // This method is invoked on the UI thread whenever the debugger connection
  // has been lost.
  virtual void OnConnectionLost() = 0;
  virtual void OnAcceptConnection(ListenSocket* connection) {}

 protected:
  friend class base::RefCountedThreadSafe<DevToolsRemoteListener>;

  virtual ~DevToolsRemoteListener() {}

 private:
  DISALLOW_COPY_AND_ASSIGN(DevToolsRemoteListener);
};

// Interface exposed by DevToolsProtocolHandler to receive reply messages
// from registered tools.
class OutboundSocketDelegate {
 public:
  virtual ~OutboundSocketDelegate() {}
  virtual void Send(const DevToolsRemoteMessage& message) = 0;
};

#endif  // CHROME_BROWSER_DEBUGGER_DEVTOOLS_REMOTE_H_