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