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
12namespace content {
13
14class DevToolsHttpHandlerDelegate;
15
16// This class implements reversed tethering handler.
17class TetheringHandler : public DevToolsProtocol::Handler {
18 public:
19  TetheringHandler(DevToolsHttpHandlerDelegate* delegate);
20  virtual ~TetheringHandler();
21
22  void Accepted(int port, const std::string& name);
23
24 private:
25  class BoundSocket;
26  scoped_refptr<DevToolsProtocol::Response> OnBind(
27      scoped_refptr<DevToolsProtocol::Command> command);
28  scoped_refptr<DevToolsProtocol::Response> OnUnbind(
29      scoped_refptr<DevToolsProtocol::Command>  command);
30
31  typedef std::map<int, BoundSocket*> BoundSockets;
32  BoundSockets bound_sockets_;
33  DevToolsHttpHandlerDelegate* delegate_;
34  DISALLOW_COPY_AND_ASSIGN(TetheringHandler);
35};
36
37}  // namespace content
38
39#endif  // CONTENT_BROWSER_DEVTOOLS_TETHERING_HANDLER_H_
40