Home | History | Annotate | Download | only in devtools
      1 // Copyright (c) 2012 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 CONTENT_BROWSER_DEVTOOLS_TETHERING_HANDLER_H_
      6 #define CONTENT_BROWSER_DEVTOOLS_TETHERING_HANDLER_H_
      7 
      8 #include <map>
      9 
     10 #include "content/browser/devtools/devtools_protocol.h"
     11 
     12 namespace content {
     13 
     14 class DevToolsHttpHandlerDelegate;
     15 
     16 // This class implements reversed tethering handler.
     17 class TetheringHandler : public DevToolsProtocol::Handler {
     18  public:
     19   static const char kDomain[];
     20 
     21   TetheringHandler(DevToolsHttpHandlerDelegate* delegate);
     22   virtual ~TetheringHandler();
     23 
     24   void Accepted(int port, const std::string& name);
     25 
     26  private:
     27   class BoundSocket;
     28   scoped_refptr<DevToolsProtocol::Response> OnBind(
     29       scoped_refptr<DevToolsProtocol::Command> command);
     30   scoped_refptr<DevToolsProtocol::Response> OnUnbind(
     31       scoped_refptr<DevToolsProtocol::Command>  command);
     32 
     33   typedef std::map<int, BoundSocket*> BoundSockets;
     34   BoundSockets bound_sockets_;
     35   DevToolsHttpHandlerDelegate* delegate_;
     36   DISALLOW_COPY_AND_ASSIGN(TetheringHandler);
     37 };
     38 
     39 }  // namespace content
     40 
     41 #endif  // CONTENT_BROWSER_DEVTOOLS_TETHERING_HANDLER_H_
     42