1 // Copyright 2014 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.
5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TETHERING_HANDLER_H_
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TETHERING_HANDLER_H_
8 #include "base/memory/weak_ptr.h"
9 #include "base/message_loop/message_loop_proxy.h"
10 #include "content/browser/devtools/protocol/devtools_protocol_handler_impl.h"
14 class DevToolsHttpHandlerDelegate
;
19 // This class implements reversed tethering handler.
20 class TetheringHandler
{
22 TetheringHandler(DevToolsHttpHandlerDelegate
* delegate
,
23 scoped_refptr
<base::MessageLoopProxy
> message_loop_proxy
);
26 void SetClient(scoped_ptr
<Client
> client
);
28 scoped_refptr
<DevToolsProtocol::Response
> Bind(
29 int port
, scoped_refptr
<DevToolsProtocol::Command
> command
);
30 scoped_refptr
<DevToolsProtocol::Response
> Unbind(
31 int port
, scoped_refptr
<DevToolsProtocol::Command
> command
);
36 void Accepted(int port
, const std::string
& name
);
39 void SendBindSuccess(scoped_refptr
<DevToolsProtocol::Command
> command
);
40 void SendUnbindSuccess(scoped_refptr
<DevToolsProtocol::Command
> command
);
41 void SendInternalError(scoped_refptr
<DevToolsProtocol::Command
> command
,
42 const std::string
& message
);
44 scoped_ptr
<Client
> client_
;
45 DevToolsHttpHandlerDelegate
* delegate_
;
46 scoped_refptr
<base::MessageLoopProxy
> message_loop_proxy_
;
48 base::WeakPtrFactory
<TetheringHandler
> weak_factory_
;
50 static TetheringImpl
* impl_
;
52 DISALLOW_COPY_AND_ASSIGN(TetheringHandler
);
55 } // namespace tethering
56 } // namespace devtools
57 } // namespace content
59 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TETHERING_HANDLER_H_