devtools_remote.h revision c407dc5cd9bdc5668497f21b26b09d988ab439de
1// Copyright (c) 2009 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.
4
5#ifndef CHROME_BROWSER_DEBUGGER_DEVTOOLS_REMOTE_H_
6#define CHROME_BROWSER_DEBUGGER_DEVTOOLS_REMOTE_H_
7
8#include "base/basictypes.h"
9#include "base/ref_counted.h"
10
11class DevToolsRemoteMessage;
12class ListenSocket;
13
14// This interface should be implemented by a class that wants to handle
15// DevToolsRemoteMessages dispatched by some entity. It must extend
16class DevToolsRemoteListener
17    : public base::RefCountedThreadSafe<DevToolsRemoteListener> {
18 public:
19  DevToolsRemoteListener() {}
20  virtual void HandleMessage(const DevToolsRemoteMessage& message) = 0;
21  // This method is invoked on the UI thread whenever the debugger connection
22  // has been lost.
23  virtual void OnConnectionLost() = 0;
24  virtual void OnAcceptConnection(ListenSocket* connection) {}
25
26 protected:
27  friend class base::RefCountedThreadSafe<DevToolsRemoteListener>;
28
29  virtual ~DevToolsRemoteListener() {}
30
31 private:
32  DISALLOW_COPY_AND_ASSIGN(DevToolsRemoteListener);
33};
34
35// Interface exposed by DevToolsProtocolHandler to receive reply messages
36// from registered tools.
37class OutboundSocketDelegate {
38 public:
39  virtual ~OutboundSocketDelegate() {}
40  virtual void Send(const DevToolsRemoteMessage& message) = 0;
41};
42
43#endif  // CHROME_BROWSER_DEBUGGER_DEVTOOLS_REMOTE_H_
44