cc: Make picture pile base thread safe.
[chromium-blink-merge.git] / content / browser / devtools / tethering_handler.h
blobd6e56b592fd7a2176a86dfc6a5655ddb2efe41a0
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.
5 #ifndef CONTENT_BROWSER_DEVTOOLS_TETHERING_HANDLER_H_
6 #define CONTENT_BROWSER_DEVTOOLS_TETHERING_HANDLER_H_
8 #include <map>
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/weak_ptr.h"
12 #include "content/browser/devtools/devtools_protocol.h"
14 namespace content {
16 class DevToolsHttpHandlerDelegate;
18 // This class implements reversed tethering handler.
19 class TetheringHandler : public DevToolsProtocol::Handler {
20 public:
21 TetheringHandler(DevToolsHttpHandlerDelegate* delegate,
22 scoped_refptr<base::MessageLoopProxy> message_loop_proxy);
23 ~TetheringHandler() override;
25 private:
26 class TetheringImpl;
28 void Accepted(int port, const std::string& name);
29 bool Activate();
31 scoped_refptr<DevToolsProtocol::Response> OnBind(
32 scoped_refptr<DevToolsProtocol::Command> command);
33 scoped_refptr<DevToolsProtocol::Response> OnUnbind(
34 scoped_refptr<DevToolsProtocol::Command> command);
36 void SendBindSuccess(scoped_refptr<DevToolsProtocol::Command> command);
37 void SendUnbindSuccess(scoped_refptr<DevToolsProtocol::Command> command);
38 void SendInternalError(scoped_refptr<DevToolsProtocol::Command> command,
39 const std::string& message);
41 DevToolsHttpHandlerDelegate* delegate_;
42 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_;
43 bool is_active_;
44 base::WeakPtrFactory<TetheringHandler> weak_factory_;
46 static TetheringImpl* impl_;
48 DISALLOW_COPY_AND_ASSIGN(TetheringHandler);
51 } // namespace content
53 #endif // CONTENT_BROWSER_DEVTOOLS_TETHERING_HANDLER_H_