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_DEVTOOLS_PROTOCOL_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_H_ |
6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_H_ |
7 | 7 |
8 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" | 8 #include "content/browser/devtools/protocol/devtools_protocol_dispatcher.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 class DevToolsAgentHost; | 12 class DevToolsAgentHost; |
| 13 class DevToolsAgentHostImpl; |
| 14 class DevToolsProtocolDelegate; |
13 | 15 |
14 class DevToolsProtocolHandler { | 16 class DevToolsProtocolHandler { |
15 public: | 17 public: |
16 using Response = DevToolsProtocolClient::Response; | 18 using Response = DevToolsProtocolClient::Response; |
17 using Notifier = base::Callback<void(const std::string& message)>; | |
18 | 19 |
19 DevToolsProtocolHandler(DevToolsAgentHost* agent_host, | 20 explicit DevToolsProtocolHandler(DevToolsAgentHostImpl* agent_host); |
20 const Notifier& notifier); | |
21 virtual ~DevToolsProtocolHandler(); | 21 virtual ~DevToolsProtocolHandler(); |
22 | 22 |
23 void HandleMessage(const std::string& message); | 23 void HandleMessage(int session_id, const std::string& message); |
24 bool HandleOptionalMessage(const std::string& message, int* call_id); | 24 bool HandleOptionalMessage(int session_id, |
| 25 const std::string& message, |
| 26 int* call_id); |
25 | 27 |
26 DevToolsProtocolDispatcher* dispatcher() { return &dispatcher_; } | 28 DevToolsProtocolDispatcher* dispatcher() { return &dispatcher_; } |
27 | 29 |
28 private: | 30 private: |
29 scoped_ptr<base::DictionaryValue> ParseCommand(const std::string& message); | 31 scoped_ptr<base::DictionaryValue> ParseCommand(int session_id, |
30 bool PassCommandToDelegate(base::DictionaryValue* command); | 32 const std::string& message); |
31 void HandleCommand(scoped_ptr<base::DictionaryValue> command); | 33 bool PassCommandToDelegate(int session_id, base::DictionaryValue* command); |
32 bool HandleOptionalCommand(scoped_ptr<base::DictionaryValue> command, | 34 void HandleCommand(int session_id, scoped_ptr<base::DictionaryValue> command); |
| 35 bool HandleOptionalCommand(int session_id, |
| 36 scoped_ptr<base::DictionaryValue> command, |
33 int* call_id); | 37 int* call_id); |
34 | 38 |
35 DevToolsAgentHost* agent_host_; | 39 DevToolsAgentHost* agent_host_; |
36 DevToolsProtocolClient client_; | 40 DevToolsProtocolClient client_; |
37 DevToolsProtocolDispatcher dispatcher_; | 41 DevToolsProtocolDispatcher dispatcher_; |
38 }; | 42 }; |
39 | 43 |
40 } // namespace content | 44 } // namespace content |
41 | 45 |
42 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_H_ | 46 #endif // CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_HANDLER_H_ |
OLD | NEW |