OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TETHERING_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TETHERING_HANDLER_H_ |
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TETHERING_HANDLER_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TETHERING_HANDLER_H_ |
7 | 7 |
8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "content/browser/devtools/protocol/devtools_protocol_handler_impl.h" | 10 #include "content/browser/devtools/protocol/devtools_protocol_handler_impl.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 class DevToolsHttpHandlerDelegate; | 14 class DevToolsHttpHandlerDelegate; |
15 | 15 |
16 namespace devtools { | 16 namespace devtools { |
17 namespace tethering { | 17 namespace tethering { |
18 | 18 |
19 // This class implements reversed tethering handler. | 19 // This class implements reversed tethering handler. |
20 class TetheringHandler { | 20 class TetheringHandler { |
21 public: | 21 public: |
22 TetheringHandler(DevToolsHttpHandlerDelegate* delegate, | 22 TetheringHandler(DevToolsHttpHandlerDelegate* delegate, |
23 scoped_refptr<base::MessageLoopProxy> message_loop_proxy); | 23 scoped_refptr<base::MessageLoopProxy> message_loop_proxy); |
24 ~TetheringHandler(); | 24 ~TetheringHandler(); |
25 | 25 |
26 void SetClient(scoped_ptr<Client> client); | 26 void SetClient(scoped_ptr<Client> client); |
27 | 27 |
28 scoped_refptr<DevToolsProtocol::Response> Bind( | 28 scoped_refptr<DevToolsProtocol::Response> Bind( |
29 int port, scoped_refptr<DevToolsProtocol::Command> command); | 29 uint16 port, scoped_refptr<DevToolsProtocol::Command> command); |
30 scoped_refptr<DevToolsProtocol::Response> Unbind( | 30 scoped_refptr<DevToolsProtocol::Response> Unbind( |
31 int port, scoped_refptr<DevToolsProtocol::Command> command); | 31 uint16 port, scoped_refptr<DevToolsProtocol::Command> command); |
32 | 32 |
33 private: | 33 private: |
34 class TetheringImpl; | 34 class TetheringImpl; |
35 | 35 |
36 void Accepted(int port, const std::string& name); | 36 void Accepted(uint16 port, const std::string& name); |
37 bool Activate(); | 37 bool Activate(); |
38 | 38 |
39 void SendBindSuccess(scoped_refptr<DevToolsProtocol::Command> command); | 39 void SendBindSuccess(scoped_refptr<DevToolsProtocol::Command> command); |
40 void SendUnbindSuccess(scoped_refptr<DevToolsProtocol::Command> command); | 40 void SendUnbindSuccess(scoped_refptr<DevToolsProtocol::Command> command); |
41 void SendInternalError(scoped_refptr<DevToolsProtocol::Command> command, | 41 void SendInternalError(scoped_refptr<DevToolsProtocol::Command> command, |
42 const std::string& message); | 42 const std::string& message); |
43 | 43 |
44 scoped_ptr<Client> client_; | 44 scoped_ptr<Client> client_; |
45 DevToolsHttpHandlerDelegate* delegate_; | 45 DevToolsHttpHandlerDelegate* delegate_; |
46 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; | 46 scoped_refptr<base::MessageLoopProxy> message_loop_proxy_; |
47 bool is_active_; | 47 bool is_active_; |
48 base::WeakPtrFactory<TetheringHandler> weak_factory_; | 48 base::WeakPtrFactory<TetheringHandler> weak_factory_; |
49 | 49 |
50 static TetheringImpl* impl_; | 50 static TetheringImpl* impl_; |
51 | 51 |
52 DISALLOW_COPY_AND_ASSIGN(TetheringHandler); | 52 DISALLOW_COPY_AND_ASSIGN(TetheringHandler); |
53 }; | 53 }; |
54 | 54 |
55 } // namespace tethering | 55 } // namespace tethering |
56 } // namespace devtools | 56 } // namespace devtools |
57 } // namespace content | 57 } // namespace content |
58 | 58 |
59 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TETHERING_HANDLER_H_ | 59 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_TETHERING_HANDLER_H_ |
OLD | NEW |